Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluent Assertions "Maximum recursion depth was reached…"

I have a number of nested complex objects that I'm attempting to compare with Fluent Assertions with the following code:

restResponse.Should().BeEquivalentTo(mappedSoapResponse, options =>
            {
                options.AllowingInfiniteRecursion();
                options.IgnoringCyclicReferences();
                return options;
            });

Despite this however I keep hitting an issue with "Maximum recursion depth was reached…" despite specially enabling infinite recursion.

like image 461
m.edmondson Avatar asked Jul 22 '26 03:07

m.edmondson


1 Answers

Have you tried adding this beforehand

AssertionOptions.FormattingOptions.MaxDepth = 100;
like image 187
chris31389 Avatar answered Jul 24 '26 16:07

chris31389



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!