|
|
|
@ -55,10 +55,10 @@ namespace UnitTesting
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ExceptionSerialisation()
|
|
|
|
|
{
|
|
|
|
|
CodeIncompletException exception = new CodeIncompletException();
|
|
|
|
|
CodeVideException exception = new CodeVideException();
|
|
|
|
|
|
|
|
|
|
#pragma warning disable SYSLIB0050
|
|
|
|
|
SerializationInfo info = new SerializationInfo(typeof(CodeIncompletException), new FormatterConverter());
|
|
|
|
|
SerializationInfo info = new SerializationInfo(typeof(CodeVideException), new FormatterConverter());
|
|
|
|
|
StreamingContext contexte = new StreamingContext(StreamingContextStates.All);
|
|
|
|
|
#pragma warning restore SYSLIB0050
|
|
|
|
|
|
|
|
|
@ -69,11 +69,11 @@ namespace UnitTesting
|
|
|
|
|
Assert.Equal(exception.Message, info.GetString("Message"));
|
|
|
|
|
|
|
|
|
|
#pragma warning disable SYSLIB0050
|
|
|
|
|
CodeIncompletException exceptionSerialisee =
|
|
|
|
|
(CodeIncompletException)FormatterServices.GetUninitializedObject(typeof(CodeIncompletException));
|
|
|
|
|
CodeVideException exceptionSerialisee =
|
|
|
|
|
(CodeVideException)FormatterServices.GetUninitializedObject(typeof(CodeVideException));
|
|
|
|
|
#pragma warning restore SYSLIB0050
|
|
|
|
|
|
|
|
|
|
ConstructorInfo? constructeur = typeof(CodeIncompletException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
|
|
|
|
|
ConstructorInfo? constructeur = typeof(CodeVideException).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(SerializationInfo), typeof(StreamingContext)], null);
|
|
|
|
|
Assert.NotNull(constructeur);
|
|
|
|
|
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
|
|
|
|
|
|
|
|
|
|