diff --git a/Sources/UnitTesting/CodeCompletExceptionUT.cs b/Sources/UnitTesting/CodeCompletExceptionUT.cs index 5982a14..cafd51a 100644 --- a/Sources/UnitTesting/CodeCompletExceptionUT.cs +++ b/Sources/UnitTesting/CodeCompletExceptionUT.cs @@ -58,13 +58,16 @@ namespace UnitTesting { CodeCompletException exception = new CodeCompletException(); + #pragma warning disable SYSLIB0050 + SerializationInfo info = new SerializationInfo(typeof(CodeCompletException), new FormatterConverter()); + StreamingContext contexte = new StreamingContext(StreamingContextStates.All); + #pragma warning restore SYSLIB0050 - string jsonString = JsonSerializer.Serialize(exception); - CodeCompletException? exceptionSerialisee = - JsonSerializer.Deserialize(jsonString); + #pragma warning disable SYSLIB0051 + exception.GetObjectData(info, contexte); + #pragma warning restore SYSLIB0051 - Assert.NotNull(exceptionSerialisee); - Assert.Equal(exception.Message, exceptionSerialisee.Message); + Assert.Equal(exception.Message, info.GetString("Message")); } } }