fin de tests des execeptions
continuous-integration/drone/push Build is passing Details

master
Céleste BARBOSA 11 months ago
parent cc61e723cb
commit ab65210bd2

@ -75,7 +75,7 @@ namespace UnitTesting
(CodeCompletException) FormatterServices.GetUninitializedObject(typeof(CodeCompletException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(CodeCompletException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(SerializationInfo), typeof(StreamingContext) }, null);
ConstructorInfo? constructeur = typeof(CodeCompletException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -50,5 +52,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
CodeIncompletException exception = new CodeIncompletException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(CodeIncompletException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
CodeIncompletException exceptionSerialisee =
(CodeIncompletException)FormatterServices.GetUninitializedObject(typeof(CodeIncompletException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(CodeIncompletException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -66,5 +68,33 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
CodeInvalideException exception = new CodeInvalideException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(CodeInvalideException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
CodeInvalideException exceptionSerialisee =
(CodeInvalideException)FormatterServices.GetUninitializedObject(typeof(CodeInvalideException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(CodeInvalideException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -50,5 +52,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
CodeIncompletException exception = new CodeIncompletException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(CodeIncompletException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
CodeIncompletException exceptionSerialisee =
(CodeIncompletException)FormatterServices.GetUninitializedObject(typeof(CodeIncompletException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(CodeIncompletException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -50,5 +52,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
GrilleCompleteException exception = new GrilleCompleteException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(GrilleCompleteException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
GrilleCompleteException exceptionSerialisee =
(GrilleCompleteException)FormatterServices.GetUninitializedObject(typeof(GrilleCompleteException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(GrilleCompleteException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -66,5 +68,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
IndiceCodeException exception = new IndiceCodeException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(IndiceCodeException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
IndiceCodeException exceptionSerialisee =
(IndiceCodeException)FormatterServices.GetUninitializedObject(typeof(IndiceCodeException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(IndiceCodeException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -50,5 +52,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
PartieNonCommenceeException exception = new PartieNonCommenceeException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(PartieNonCommenceeException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
PartieNonCommenceeException exceptionSerialisee =
(PartieNonCommenceeException)FormatterServices.GetUninitializedObject(typeof(PartieNonCommenceeException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(PartieNonCommenceeException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -65,5 +67,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
TailleCodeException exception = new TailleCodeException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(TailleCodeException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
TailleCodeException exceptionSerialisee =
(TailleCodeException)FormatterServices.GetUninitializedObject(typeof(TailleCodeException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(TailleCodeException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

@ -1,4 +1,6 @@
using CoreLibrary.Exceptions;
using System.Reflection;
using System.Runtime.Serialization;
using Xunit;
namespace UnitTesting
@ -65,5 +67,32 @@ namespace UnitTesting
}
}
[Fact]
public void ExceptionSerialisation()
{
TailleGrilleException exception = new TailleGrilleException();
#pragma warning disable SYSLIB0050
SerializationInfo info = new SerializationInfo(typeof(TailleGrilleException), new FormatterConverter());
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
#pragma warning restore SYSLIB0050
#pragma warning disable SYSLIB0051
exception.GetObjectData(info, contexte);
#pragma warning restore SYSLIB0051
Assert.Equal(exception.Message, info.GetString("Message"));
#pragma warning disable SYSLIB0050
TailleGrilleException exceptionSerialisee =
(TailleGrilleException)FormatterServices.GetUninitializedObject(typeof(TailleGrilleException));
#pragma warning restore SYSLIB0050
ConstructorInfo? constructeur = typeof(TailleGrilleException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
Assert.NotNull(constructeur);
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
Assert.Equal(exception.Message, exceptionSerialisee.Message);
}
}
}

Loading…
Cancel
Save