Here is a reimplementation of CollectionAssert.AreEquivalent (reference code was decompiled with DotPeek) however instead of throwing a exception it returns a bool.
public class CollectionMethods
{
public static bool AreEquivalent(ICollection expected, ICollection actual)
{
//We can do a few quick tests we can do to get a easy true or easy false.
//Is one collection null and one not?
if (Object.ReferenceEquals(expected, null) != Object.ReferenceEquals(actual, null))
return false;
//Do they both point at the same object?
if (Object.ReferenceEquals(expected, actual))
return true;
//Do they have diffrent counts?
if (expected.Count != actual.Count)
return false;
//Do we have two empty collections?
if (expected.Count == 0)
return true;
//Ran out of easy tests, now have to do the slow work.
int nullCount1;
Dictionary