public void LegacyExceptionsCanBeDeserialized() { var original = MakeItThrown(new StubException()); var json = ExceptionSerializer.LegacyToJson(original); var deserialized = Serializer.FromJson <Exception>(json); Assert.AreEqual(original.ToString(), deserialized.ToString()); Assert.AreEqual(original.GetType(), deserialized.GetType()); }
public void SerializedExceptionCanBeDotNetSerialized() { var payload = new JsonObject() .Add("foo", "bar") .Add("baz", 42); var original = new SerializedException(payload); var json = ExceptionSerializer.LegacyToJson(original); var deserialized = ExceptionSerializer.LegacyFromJson(json); Assert.AreEqual(typeof(SerializedException), deserialized.GetType()); Assert.AreEqual( original.SerializedValue.ToString(), ((SerializedException)deserialized).SerializedValue.ToString() ); }