使用ShouldBeEquivalentTo时,如何排除IEnumerable中所有项的属性?

在我的NUnit / FluentAssertions测试中,我使用以下代码将从系统返回的复杂对象与引用对象进行比较:

response.ShouldBeEquivalentTo(reference, o => o.Excluding(x => x.OrderStatus) .Excluding(x => x.Id) .Excluding(x => x.Items[0].Name) .Excluding(x => x.Items[0].Article) .Excluding(x => x.ResponseStatus)); 

但是,这并不是我的意图。 我想为Items列表中的每个对象排除NameArticle ,而不仅仅是第0个。 我该如何实现这种情况?

我查看了文档 ,但没有找到解决方案。 我错过了什么吗?

Excluding()的重载提供了一个ISubjectInfo,您可以将其用于更高级的选择条件。 有了这个重载,你可以做以下事情:

 subject.ShouldBeEquivalentTo(expected, config => config.Excluding(ctx => ctx.PropertyPath == "Level.Level.Text"));