【问题标题】:Fluent Assertions "Maximum recursion depth was reached…"流利的断言“已达到最大递归深度……”
【发布时间】:2023-03-22 05:28:02
【问题描述】:

我有许多嵌套的复杂对象,我尝试使用以下代码与 Fluent 断言进行比较:

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

尽管如此,尽管特别启用了无限递归,但我仍然遇到“已达到最大递归深度……”的问题。

【问题讨论】:

  • 仅仅因为你允许无限​​递归并不意味着无限递归是可能的。它最终会受到您计算机资源的限制,但是,这可能不是这里的问题。
  • @ArvinKushwaha 是的,我同意,虽然对象不是那么深
  • 是.NET还是fluentassertions库抛出的异常?

标签: c# fluent fluent-assertions


【解决方案1】:

您是否尝试过预先添加此内容

AssertionOptions.FormattingOptions.MaxDepth = 100;

【讨论】:

    猜你喜欢
    • 2011-01-09
    • 1970-01-01
    • 2016-06-14
    • 2020-02-25
    • 2017-10-11
    • 2015-06-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多