Add ability to limit graph depth in Formatter
Currently it is hardcoded to 5, which makes error messages for assertions on collections containing complex object graphs unreadable.
private static string FormatChild(string path, object childValue, bool useLineBreaks, ObjectGraph graph) {
/// ...
else if (graph.Depth > 5)
{
return "{Maximum recursion depth was reached…}";
}
}
Would be nice to have an option to pass depth to collection assertion e.g.
result.Should().Contain(p => p.Foo == "Bar", maxDepth: 1);
Current behavior
For list of 2 complex objects, I'm getting message Expected result { ... containing almost 200 lines of text
Versions
- FluentAssertions: 5.10.2
- .NET Core 2.2.
Add ability to limit graph depth in
FormatterCurrently it is hardcoded to 5, which makes error messages for assertions on collections containing complex object graphs unreadable.
Would be nice to have an option to pass depth to collection assertion e.g.
Current behavior
For list of 2 complex objects, I'm getting message
Expected result { ...containing almost 200 lines of textVersions