CollectionAssert.AreEquivalent
具体实施如下:
Assert.That(actual, new CollectionEquivalentConstraint(expected), message, args);
你可以这样写你的断言并提供一个自定义的
IEqualityComparer
Using
:
Assert.That(actual,
new CollectionEquivalentConstraint(expected).Using(customComparer));
new CollectionEquivalentConstraint
到
Is.EquivalentTo
:
Assert.That(actual, Is.EquivalentTo(expected).Using(customComparer));