Add ability to dynamically limit graph depth in `Formatter`
See original GitHub issueAdd 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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
How to Create Conditional and Dynamic Queries in ...
Consider adding a LIMIT clause to dynamic queries generated using the technique described in this post that matches Bloom's “Node query limit” ...
Read more >Securing GraphQL API endpoints using rate limits and ...
See how to secure your GraphQL API endpoints to prevent API spam and query attacks with rate and depth limiting.
Read more >Conditional Formatting of Excel Charts
As in worksheet conditional formatting, the only limit is your own ability to construct formulas.
Read more >Dynamically Formatting Graphs
Wire dynamic data or waveform data to a graph to automatically format the plot legend and x-scale time stamp for the graph.
Read more >How to Create Interactive Charts with Dynamic Elements in ...
An interactive chart is a graph that allows the user to control which data series should be illustrated in the chart, making it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. It would be easy to configure for simple cases.
I must confess I used your workaround to cut off ILog from log4net 😉. Thank you.
How about adding a
ConcurrentDictionary<Type, int>
toFormatter
to allow specifying themaxDepth
per type?