CollectionAssert.AreEquivalent with Custom IEqualityComparer

CollectionAssert.AreEquivalent is implemented as:

Assert.That(actual, new CollectionEquivalentConstraint(expected), message, args);

You can write out your assert that way and supply a custom IEqualityComparer with Using:

Assert.That(actual,
    new CollectionEquivalentConstraint(expected).Using(customComparer));

You can also shorten new CollectionEquivalentConstraint to Is.EquivalentTo:

Assert.That(actual, Is.EquivalentTo(expected).Using(customComparer));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)