c# - 流利的断言 "Maximum recursion depth was reached…"

标签 c# fluent fluent-assertions

我有许多嵌套的复杂对象,我试图通过以下代码将它们与 Fluent Assertions 进行比较:

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

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

最佳答案

你有没有试过事先添加这个

AssertionOptions.FormattingOptions.MaxDepth = 100;

关于c# - 流利的断言 "Maximum recursion depth was reached…",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63170077/

相关文章:

c# - c# 中的连字符

caSTLe-windsor - Windsor Fluent 注册 - 程序集中的所有类型

asp.net-mvc - 如何用 Fluent 语法编写 HtmlHelper

c# - FluentAssertions Should().BeEquivalentTo() 失败,列表包含从相同接口(interface)派生的运行时指定类型

c# - NHibernate 的 Nunit 测试出现奇怪的失败

c# - 如何使用 C# 比较两个 Json 对象

c# - 如何从我创建的 .mdf 数据库进行备份

c# - 有没有办法免费使用 Office 2007 工具栏创建桌面应用程序?

c# - 在 C# 中使用 Xml 序列化从一个类转换为另一个类

php - ->where() 子句似乎区分大小写