CollectionAssert CollectionAssert CollectionAssert Class

Definition

A collection of helper classes to test various conditions associated with collections within unit tests. If the condition being tested is not met, an exception is thrown.

public sealed class CollectionAssert
type CollectionAssert = class
Public NotInheritable Class CollectionAssert
Inheritance
CollectionAssertCollectionAssertCollectionAssert

Properties

That That That

Gets the singleton instance of the CollectionAssert functionality.

Methods

AllItemsAreInstancesOfType(ICollection, Type) AllItemsAreInstancesOfType(ICollection, Type) AllItemsAreInstancesOfType(ICollection, Type)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

AllItemsAreInstancesOfType(ICollection, Type, String) AllItemsAreInstancesOfType(ICollection, Type, String) AllItemsAreInstancesOfType(ICollection, Type, String)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

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

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

AllItemsAreNotNull(ICollection) AllItemsAreNotNull(ICollection) AllItemsAreNotNull(ICollection)

Tests whether all items in the specified collection are non-null and throws an exception if any element is null.

AllItemsAreNotNull(ICollection, String) AllItemsAreNotNull(ICollection, String) AllItemsAreNotNull(ICollection, String)

Tests whether all items in the specified collection are non-null and throws an exception if any element is null.

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

Tests whether all items in the specified collection are non-null and throws an exception if any element is null.

AllItemsAreUnique(ICollection) AllItemsAreUnique(ICollection) AllItemsAreUnique(ICollection)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

AllItemsAreUnique(ICollection, String) AllItemsAreUnique(ICollection, String) AllItemsAreUnique(ICollection, String)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

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

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

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

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

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

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreEqual(ICollection, ICollection, IComparer, String) AreEqual(ICollection, ICollection, IComparer, String) AreEqual(ICollection, ICollection, IComparer, String)

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreEqual(ICollection, ICollection, IComparer) AreEqual(ICollection, ICollection, IComparer) AreEqual(ICollection, ICollection, IComparer)

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreEqual(ICollection, ICollection) AreEqual(ICollection, ICollection) AreEqual(ICollection, ICollection)

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreEqual(ICollection, ICollection, String) AreEqual(ICollection, ICollection, String) AreEqual(ICollection, ICollection, String)

Tests whether the specified collections are equal and throws an exception if the two collections are not equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreEquivalent(ICollection, ICollection) AreEquivalent(ICollection, ICollection) AreEquivalent(ICollection, ICollection)

Tests whether two collections contain the same elements and throws an exception if either collection contains an element not in the other collection.

AreEquivalent(ICollection, ICollection, String) AreEquivalent(ICollection, ICollection, String) AreEquivalent(ICollection, ICollection, String)

Tests whether two collections contain the same elements and throws an exception if either collection contains an element not in the other collection.

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

Tests whether two collections contain the same elements and throws an exception if either collection contains an element not in the other collection.

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

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

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

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreNotEqual(ICollection, ICollection, IComparer, String) AreNotEqual(ICollection, ICollection, IComparer, String) AreNotEqual(ICollection, ICollection, IComparer, String)

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreNotEqual(ICollection, ICollection, IComparer) AreNotEqual(ICollection, ICollection, IComparer) AreNotEqual(ICollection, ICollection, IComparer)

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreNotEqual(ICollection, ICollection) AreNotEqual(ICollection, ICollection) AreNotEqual(ICollection, ICollection)

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreNotEqual(ICollection, ICollection, String) AreNotEqual(ICollection, ICollection, String) AreNotEqual(ICollection, ICollection, String)

Tests whether the specified collections are unequal and throws an exception if the two collections are equal. Equality is defined as having the same elements in the same order and quantity. Different references to the same value are considered equal.

AreNotEquivalent(ICollection, ICollection) AreNotEquivalent(ICollection, ICollection) AreNotEquivalent(ICollection, ICollection)

Tests whether two collections contain the different elements and throws an exception if the two collections contain identical elements without regard to order.

AreNotEquivalent(ICollection, ICollection, String) AreNotEquivalent(ICollection, ICollection, String) AreNotEquivalent(ICollection, ICollection, String)

Tests whether two collections contain the different elements and throws an exception if the two collections contain identical elements without regard to order.

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

Tests whether two collections contain the different elements and throws an exception if the two collections contain identical elements without regard to order.

Contains(ICollection, Object) Contains(ICollection, Object) Contains(ICollection, Object)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

Contains(ICollection, Object, String) Contains(ICollection, Object, String) Contains(ICollection, Object, String)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

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

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

DoesNotContain(ICollection, Object) DoesNotContain(ICollection, Object) DoesNotContain(ICollection, Object)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

DoesNotContain(ICollection, Object, String) DoesNotContain(ICollection, Object, String) DoesNotContain(ICollection, Object, String)

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

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

Tests whether the specified collection does not contain the specified element and throws an exception if the element is in the collection.

IsNotSubsetOf(ICollection, ICollection) IsNotSubsetOf(ICollection, ICollection) IsNotSubsetOf(ICollection, ICollection)

Tests whether one collection is not a subset of another collection and throws an exception if all elements in the subset are also in the superset.

IsNotSubsetOf(ICollection, ICollection, String) IsNotSubsetOf(ICollection, ICollection, String) IsNotSubsetOf(ICollection, ICollection, String)

Tests whether one collection is not a subset of another collection and throws an exception if all elements in the subset are also in the superset.

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

Tests whether one collection is not a subset of another collection and throws an exception if all elements in the subset are also in the superset.

IsSubsetOf(ICollection, ICollection, String) IsSubsetOf(ICollection, ICollection, String) IsSubsetOf(ICollection, ICollection, String)

Tests whether one collection is a subset of another collection and throws an exception if any element in the subset is not also in the superset.

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

Tests whether one collection is a subset of another collection and throws an exception if any element in the subset is not also in the superset.

IsSubsetOf(ICollection, ICollection) IsSubsetOf(ICollection, ICollection) IsSubsetOf(ICollection, ICollection)

Tests whether one collection is a subset of another collection and throws an exception if any element in the subset is not also in the superset.

Applies to