My goal is to use fluent assertions to collect all assertion failures and report them.
Currently, I use
private static void AssertValue(object? actual, object? expected, string fieldName, IDictionary<string, string> assertionFailures)
{
try
{
using (new AssertionScope(fieldName))
{
actual.Should().BeEquivalentTo(expected);
}
}
catch (Exception e)
{
assertionFailures.Add(fieldName, e.Message);
}
}
Is there a way to do this using different way not involving catching an Exception
?