Freigeben über


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 ref class CollectionAssert abstract sealed
public static class CollectionAssert
type CollectionAssert = class
Public Class CollectionAssert
Inheritance
CollectionAssert

Properties

That

Gets the singleton instance of the CollectionAssert functionality.

Methods

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.

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)

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, String, Object[])

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

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)

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

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.

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)

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[])

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)

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)

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[])

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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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.

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)

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, 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)

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)

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, 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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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. Whether two elements are the same is checked using Equals(Object, Object) method. Different references to the same value are considered equal.

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.

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)

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, String, 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)

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

Contains(ICollection, 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, String, 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)

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)

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, 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.

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)

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, 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, 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)

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