The CollectionAssert class provides a number of methods that are useful when examining collections and their contents or for compariing two collections.
The AreEqual overloads succeed if the two collections contain the same objects, in the same order. AreEquivalent tests whether the collections contain the same objects, without regard to order.
CollectionAssert.AllItemsAreInstancesOfType( Collection collection, Type expectedType ); CollectionAssert.AllItemsAreInstancesOfType( Collection collection, Type expectedType, string message ); CollectionAssert.AllItemsAreInstancesOfType( Collection collection, Type expectedType, string message, params object[] args ); CollectionAssert.AllItemsAreNotNull( Collection collection ); CollectionAssert.AllItemsAreNotNull( Collection collection, string message ); CollectionAssert.AllItemsAreNotNull( Collection collection, string message, params object[] args ); CollectionAssert.AllItemsAreUnique( Collection collection ); CollectionAssert.AllItemsAreUnique( Collection collection, string message ); CollectionAssert.AllItemsAreUnique( Collection collection, string message, params object[] args ); CollectionAssert.AreEqual( Collection expected, Collection actual ); CollectionAssert.AreEqual( Collection expected, Collection actual, string message ); CollectionAssert.AreEqual( Collection expected, Collection actual string message, params object[] args ); CollectionAssert.AreEquivalent( Collection expected, Collection actual); CollectionAssert.AreEquivalent( Collection expected, Collection actual, string message ); CollectionAssert.AreEquivalent( Collection expected, Collection actual string message, params object[] args ); CollectionAssert.AreNotEqual( Collection expected, Collection actual ); CollectionAssert.AreNotEqual( Collection expected, Collection actual, string message ); CollectionAssert.AreNotEqual( Collection expected, Collection actual string message, params object[] args ); CollectionAssert.AreNotEquivalent( Collection expected, Collection actual ); CollectionAssert.AreNotEquivalent( Collection expected, Collection actual, string message ); CollectionAssert.AreNotEquivalent( Collection expected, Collection actual, string message, params object[] args ); CollectionAssert.Contains( Collection expected, object actual ); CollectionAssert.Contains( Collection expected, object actual, string message ); CollectionAssert.Contains( Collection expected, object actual string message, params object[] args ); CollectionAssert.DoesNotContain( Collection expected, object actual ); CollectionAssert.DoesNotContain( Collection expected, object actual, string message ); CollectionAssert.DoesNotContain( Collection expected, object actual string message, params object[] args ); CollectionAssert.IsSubsetOf( Collection subset, Collection superset ); CollectionAssert.IsSubsetOf( Collection subset, Collection superset, string message ); CollectionAssert.IsSubsetOf( Collection subset, Collection superset, string message, params object[] args ); CollectionAssert.IsNotSubsetOf( Collection subset, Collection superset); CollectionAssert.IsNotSubsetOf( Collection subset, Collection superset, string message ); CollectionAssert.IsNotSubsetOf( Collection subset, Collection superset, string message, params object[] args ); CollectionAssert.IsEmpty( Collection collection ); CollectionAssert.IsEmpty( Collection collection, string message ); CollectionAssert.IsEmpty( Collection collection, string message, params object[] args ); CollectionAssert.IsNotEmpty( Collection collection ); CollectionAssert.IsNotEmpty( Collection collection, string message ); CollectionAssert.IsNotEmpty( Collection collection, string message, params object[] args );