Fluent Assertions "Maximum recursion depth was reached…"
Asked Answered
A

1

7

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.

Asthenopia answered 30/7, 2020 at 9:22 Comment(3)
Just because you allow infinite recursion does not mean that infinite recursion is possible. It will eventually be limited by your computer's resources, however, that is probably not the issue here.December
@ArvinKushwaha Yea I agree, the objects aren't that deep thoughAsthenopia
Is it an exception thrown by the .NET or the fluentassertions library?Ejaculate
T
10

Have you tried adding this beforehand

AssertionOptions.FormattingOptions.MaxDepth = 100;
Teenyweeny answered 2/2, 2022 at 16:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.