tentative de test sur exception serialisée
continuous-integration/drone/push Build is passing Details

master
Céleste BARBOSA 11 months ago
parent 11eb607a20
commit 32917a5909

@ -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<CodeCompletException>(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"));
}
}
}

Loading…
Cancel
Save