-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Motivation:
When we encounter an error serializing a property on a context object, other properties still might be useful to the reader. Further, readers might be confused that the serialization error is what caused their test to fail, when in fact the serialization error only happened after the test failed for another reason.
To Repro:
[Test]
public void BadPropertySerialization()
{
var foo = new FooDto { Id = 1 };
AssertEx.IsTrue(() => foo == null);
}
private sealed class FooDto
{
public int Id { get; set; }
public string Bad => throw new Exception("Bad!");
}
Expected Output:
Expected:
foo == null
Actual:
foo = { Id: 1, Bad: [Newtonsoft.Json.JsonSerializationException: Error getting value from 'Bad' on 'Logos.AccountServices.Tests.IntegrationTests.Accounts.V1.PinTests+FooDto'.] }
Actual Output:
Expected:
foo == null
Actual:
foo = <Logos.AccountServices.Tests.IntegrationTests.Accounts.V1.PinTests+FooDto> [Newtonsoft.Json.JsonSerializationException: Error getting value from 'Bad' on 'Logos.AccountServices.Tests.IntegrationTests.Accounts.V1.PinTests+FooDto'.]
Metadata
Metadata
Assignees
Labels
No labels