我有一对列表,我试图使用Fluent断言进行比较.我可以轻松编写比较代码,但我想使用Fluent Assertions,以便我可以在测试失败消息中显示出来的原因.
到目前为止我看到的所有内容似乎都使用默认的Object.Equals比较,它区分大小写.我似乎无法将IComparer传递给Equal或Contains方法,那么还有其他方法吗?
[TestMethod()]
public void foo()
{
var actual = new List<string> { "ONE", "TWO", "THREE", "FOUR" };
var expected = new List<string> { "One", "Two", "Three", "Four" };
actual.Should().Equal(expected);
}
Run Code Online (Sandbox Code Playgroud) 我有一个引用了很多WCF服务的C#项目.对于本地测试,我想替换身份标记的内容,以便它接受在localhost上运行的任何内容.
以下转换有效,但仅在第一个匹配位置插入dns元素.因此,如果我引用了5个端点,则会有一个dns标记,而其他端点都会有空的标识元素.
<system.serviceModel>
<client>
<endpoint>
<identity>
<dns xdt:Transform="Insert" value="localhost"/>
<userPrincipalName xdt:Transform="RemoveAll" value="someIdentity" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
如何更改所有匹配元素,而不仅仅是第一个?