Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CollectionAssert Class

 

Verifies true/false propositions associated with collections in unit tests.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

System.Object
  Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert

public static class CollectionAssert

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreInstancesOfType(ICollection, Type)

Verifies that all elements in the specified collection are instances of the specified type. The assertion fails if for any element the type is not found in its inheritance hierarchy.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreInstancesOfType(ICollection, Type, String)

Verifies that all elements in the specified collection are instances of the specified type. The assertion fails if there exists one element in the collection for which the specified type is not found in its inheritance hierarchy. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreInstancesOfType(ICollection, Type, String, Object[])

Verifies that all elements in the specified collection are instances of the specified type. The assertion fails if there exists one element in the collection for which the specified type is not found in its inheritance hierarchy. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreNotNull(ICollection)

Verifies that all items in the specified collection are not null. The assertion fails if any element is null.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreNotNull(ICollection, String)

Verifies that all items in the specified collection are not null. The assertion fails if any element is null. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreNotNull(ICollection, String, Object[])

Verifies that all items in the specified collection are not null. The assertion fails if any element is null. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreUnique(ICollection)

Verifies that all items in the specified collection are unique. The assertion fails if any two elements in the collection are equal.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreUnique(ICollection, String)

Verifies that all items in the specified collection are unique. The assertion fails if any two elements in the collection are equal. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAllItemsAreUnique(ICollection, String, Object[])

Verifies that all items in the specified collection are unique. The assertion fails if any two elements in the collection are equal. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection)

Verifies that two specified collections are equal. The assertion fails if the collections are not equal.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection, IComparer)

Verifies that two specified collections are equal, using the specified method to compare the values of elements. The assertion fails if the collections are not equal.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection, IComparer, String)

Verifies that two specified collections are equal, using the specified method to compare the values of elements. The assertion fails if the collections are not equal. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection, IComparer, String, Object[])

Verifies that two specified collections are equal, using the specified method to compare the values of elements. The assertion fails if the collections are not equal. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection, String)

Verifies that two specified collections are equal. The assertion fails if the collections are not equal. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreEqual(ICollection, ICollection, String, Object[])

Verifies that two specified collections are equal. The assertion fails if the collections are not equal. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreEquivalent(ICollection, ICollection)

Verifies that two specified collections are equivalent. The assertion fails if the collections are not equivalent.

System_CAPS_pubmethodSystem_CAPS_staticAreEquivalent(ICollection, ICollection, String)

Verifies that two specified collections are equivalent. The assertion fails if the collections are not equivalent. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreEquivalent(ICollection, ICollection, String, Object[])

Verifies that two specified collections are equivalent. The assertion fails if the collections are not equivalent. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection)

Verifies that two specified collections are not equal. The assertion fails if the collections are equal.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection, IComparer)

Verifies that two specified collections are not equal, using the specified method to compare the values of elements. The assertion fails if the collections are equal.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection, IComparer, String)

Verifies that two specified collections are not equal, using the specified method to compare the values of elements. The assertion fails if the collections are equal. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection, IComparer, String, Object[])

Verifies that two specified collections are not equal, using the specified method to compare the values of elements. The assertion fails if the collections are equal. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection, String)

Verifies that two specified collections are not equal. The assertion fails if the collections are equal. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEqual(ICollection, ICollection, String, Object[])

Verifies that two specified collections are not equal. The assertion fails if the collections are equal. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEquivalent(ICollection, ICollection)

Verifies that two specified collections are not equivalent. The assertion fails if the collections are equivalent.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEquivalent(ICollection, ICollection, String)

Verifies that two specified collections are not equivalent. The assertion fails if the collections are equivalent. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticAreNotEquivalent(ICollection, ICollection, String, Object[])

Verifies that two specified collections are not equivalent. The assertion fails if the collections are equivalent. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticContains(ICollection, Object)

Verifies that the specified collection contains the specified element. The assertion fails if the element is not found in the collection.

System_CAPS_pubmethodSystem_CAPS_staticContains(ICollection, Object, String)

Verifies that the specified collection contains the specified element. The assertion fails if the element is not found in the collection. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticContains(ICollection, Object, String, Object[])

Verifies that the specified collection contains the specified element. The assertion fails if the element is not found in the collection. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotContain(ICollection, Object)

Verifies that the specified collection does not contain the specified element. The assertion fails if the element is found in the collection.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotContain(ICollection, Object, String)

Verifies that the specified collection does not contain the specified element. The assertion fails if the element is found in the collection. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticDoesNotContain(ICollection, Object, String, Object[])

Verifies that the specified collection does not contain the specified element. The assertion fails if the element is found in the collection. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticIsNotSubsetOf(ICollection, ICollection)

Verifies that the first collection is not a subset of the second collection.

System_CAPS_pubmethodSystem_CAPS_staticIsNotSubsetOf(ICollection, ICollection, String)

Verifies that the first collection is not a subset of the second collection. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticIsNotSubsetOf(ICollection, ICollection, String, Object[])

Verifies that the first collection is not a subset of the second collection. Displays a message if the assertion fails, and applies the specified formatting to it.

System_CAPS_pubmethodSystem_CAPS_staticIsSubsetOf(ICollection, ICollection)

Verifies that the first collection is a subset of the second collection.

System_CAPS_pubmethodSystem_CAPS_staticIsSubsetOf(ICollection, ICollection, String)

Verifies that the first collection is a subset of the second collection. Displays a message if the assertion fails.

System_CAPS_pubmethodSystem_CAPS_staticIsSubsetOf(ICollection, ICollection, String, Object[])

Verifies that the first collection is a subset of the second collection. Displays a message if the assertion fails, and applies the specified formatting to it.

This class contains a set of static methods that evaluate a Boolean condition. If this condition evaluates to true, the assertion passes.

An assertion verifies an assumption of truth for compared conditions.

If the condition being verified is not true, the assertion fails.

System_CAPS_importantImportant

The CollectionAssert class throws an AssertFailedException to signal a failure. This exception should not be captured. This exception is handled by the unit test engine to indicate an assert failure.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: