|
|
@ -1,4 +1,5 @@
|
|
|
|
using CoreLibrary.Exceptions;
|
|
|
|
using CoreLibrary.Exceptions;
|
|
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
|
|
using System.Text.Json;
|
|
|
|
using System.Text.Json;
|
|
|
@ -68,6 +69,17 @@ namespace UnitTesting
|
|
|
|
#pragma warning restore SYSLIB0051
|
|
|
|
#pragma warning restore SYSLIB0051
|
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal(exception.Message, info.GetString("Message"));
|
|
|
|
Assert.Equal(exception.Message, info.GetString("Message"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma warning disable SYSLIB0050
|
|
|
|
|
|
|
|
CodeCompletException exceptionSerialisee =
|
|
|
|
|
|
|
|
(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);
|
|
|
|
|
|
|
|
Assert.NotNull(constructeur);
|
|
|
|
|
|
|
|
constructeur.Invoke(exceptionSerialisee, [info, contexte]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal(exception.Message, exceptionSerialisee.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|