Get exception messages as C# object/JSON #2666
-
Hi, Is there a way to get the failed assertions from the exception message as a C# object/JSON string? I would like to iterate over the failed assertions and do some actions for my objects. If my use case cannot be implemented with this library, are there any alternatives that you know of? Example use case: // firstObject.thing = null and secondObject.thing = 123456
firstObject.Should().BeEquivalentTo(secondObject, options => options.Excluding(o => o.otherThing)...);
// Expected property firstObject.thing to be 123456, but found <null>. I would like to iterate through the failed assertions and set Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
No, the only thing you'll get is the framework-specific exception, e.g. |
Beta Was this translation helpful? Give feedback.
-
Huh. If you need to see which exact mismatches there are, you already get that information as part of the |
Beta Was this translation helpful? Give feedback.
No, the only thing you'll get is the framework-specific exception, e.g.
XUnitException
.