6

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.

m.edmondson
  • 30,382
  • 27
  • 123
  • 206
  • 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. – Arvin Kushwaha Jul 30 '20 at 09:26
  • @ArvinKushwaha Yea I agree, the objects aren't that deep though – m.edmondson Jul 30 '20 at 09:26
  • Is it an exception thrown by the .NET or the fluentassertions library? – Bruno Jul 30 '20 at 11:48

1 Answers1

7

Have you tried adding this beforehand

AssertionOptions.FormattingOptions.MaxDepth = 100;
chris31389
  • 8,414
  • 7
  • 55
  • 66