C# Класс NUnit.Framework.CollectionAssert

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AllItemsAreInstancesOfType ( IEnumerable collection, Type expectedType ) : void

Asserts that all items contained in collection are of the type specified by expectedType.

AllItemsAreInstancesOfType ( IEnumerable collection, Type expectedType, string message ) : void

Asserts that all items contained in collection are of the type specified by expectedType.

AllItemsAreNotNull ( IEnumerable collection ) : void

Asserts that all items contained in collection are not equal to null.

AllItemsAreNotNull ( IEnumerable collection, string message ) : void

Asserts that all items contained in collection are not equal to null.

AllItemsAreUnique ( IEnumerable collection ) : void

Ensures that every object contained in collection exists within the collection once and only once.

AllItemsAreUnique ( IEnumerable collection, string message ) : void

Ensures that every object contained in collection exists within the collection once and only once.

AreEqual ( IEnumerable expected, IEnumerable actual ) : void

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order.

AreEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer ) : void

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order. If comparer is not null then it will be used to compare the objects.

AreEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer, string message ) : void

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order. If comparer is not null then it will be used to compare the objects.

AreEqual ( IEnumerable expected, IEnumerable actual, string message ) : void

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order.

AreEquivalent ( IEnumerable expected, IEnumerable actual ) : void

Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.

AreEquivalent ( IEnumerable expected, IEnumerable actual, string message ) : void

Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.

AreNotEqual ( IEnumerable expected, IEnumerable actual ) : void

Asserts that expected and actual are not exactly equal.

AreNotEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer ) : void

Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects.

AreNotEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer, string message ) : void

Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects.

AreNotEqual ( IEnumerable expected, IEnumerable actual, string message ) : void

Asserts that expected and actual are not exactly equal.

AreNotEquivalent ( IEnumerable expected, IEnumerable actual ) : void

Asserts that expected and actual are not equivalent.

AreNotEquivalent ( IEnumerable expected, IEnumerable actual, string message ) : void

Asserts that expected and actual are not equivalent.

Contains ( IEnumerable collection, Object actual ) : void

Asserts that collection contains actual as an item.

Contains ( IEnumerable collection, Object actual, string message ) : void

Asserts that collection contains actual as an item.

DoesNotContain ( IEnumerable collection, Object actual ) : void

Asserts that collection does not contain actual as an item.

DoesNotContain ( IEnumerable collection, Object actual, string message ) : void

Asserts that collection does not contain actual as an item.

IsEmpty ( IEnumerable collection ) : void

Assert that an array,list or other collection is empty

IsEmpty ( IEnumerable collection, string message ) : void

Assert that an array, list or other collection is empty

IsNotEmpty ( IEnumerable collection ) : void

Assert that an array,list or other collection is empty

IsNotEmpty ( IEnumerable collection, string message ) : void

Assert that an array, list or other collection is empty

IsNotSubsetOf ( IEnumerable subset, IEnumerable superset ) : void

Asserts that the superset does not contain the subset

IsNotSubsetOf ( IEnumerable subset, IEnumerable superset, string message ) : void

Asserts that the superset does not contain the subset

IsNotSupersetOf ( IEnumerable superset, IEnumerable subset ) : void

Asserts that the subset does not contain the superset

IsNotSupersetOf ( IEnumerable superset, IEnumerable subset, string message ) : void

Asserts that the subset does not contain the superset

IsOrdered ( IEnumerable collection ) : void

Assert that an array, list or other collection is ordered

IsOrdered ( IEnumerable collection, IComparer comparer ) : void

Assert that an array, list or other collection is ordered

IsOrdered ( IEnumerable collection, IComparer comparer, string message ) : void

Assert that an array, list or other collection is ordered

IsOrdered ( IEnumerable collection, string message ) : void

Assert that an array, list or other collection is ordered

IsSubsetOf ( IEnumerable subset, IEnumerable superset ) : void

Asserts that the superset contains the subset.

IsSubsetOf ( IEnumerable subset, IEnumerable superset, string message ) : void

Asserts that the superset contains the subset.

IsSupersetOf ( IEnumerable superset, IEnumerable subset ) : void

Asserts that the subset contains the superset.

IsSupersetOf ( IEnumerable superset, IEnumerable subset, string message ) : void

Asserts that the subset contains the superset.

ReferenceEquals ( object a, object b ) : void

DO NOT USE! The ReferenceEquals method throws an InvalidOperationException. This is done to make sure there is no mistake by calling this function.

Приватные методы

Метод Описание
Equals ( object a, object b ) : bool

Описание методов

AllItemsAreInstancesOfType() публичный статический Метод

Asserts that all items contained in collection are of the type specified by expectedType.
public static AllItemsAreInstancesOfType ( IEnumerable collection, Type expectedType ) : void
collection IEnumerable IEnumerable containing objects to be considered
expectedType Type System.Type that all objects in collection must be instances of
Результат void

AllItemsAreInstancesOfType() публичный статический Метод

Asserts that all items contained in collection are of the type specified by expectedType.
public static AllItemsAreInstancesOfType ( IEnumerable collection, Type expectedType, string message ) : void
collection IEnumerable IEnumerable containing objects to be considered
expectedType Type System.Type that all objects in collection must be instances of
message string The message that will be displayed on failure
Результат void

AllItemsAreNotNull() публичный статический Метод

Asserts that all items contained in collection are not equal to null.
public static AllItemsAreNotNull ( IEnumerable collection ) : void
collection IEnumerable IEnumerable containing objects to be considered
Результат void

AllItemsAreNotNull() публичный статический Метод

Asserts that all items contained in collection are not equal to null.
public static AllItemsAreNotNull ( IEnumerable collection, string message ) : void
collection IEnumerable IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

AllItemsAreUnique() публичный статический Метод

Ensures that every object contained in collection exists within the collection once and only once.
public static AllItemsAreUnique ( IEnumerable collection ) : void
collection IEnumerable IEnumerable of objects to be considered
Результат void

AllItemsAreUnique() публичный статический Метод

Ensures that every object contained in collection exists within the collection once and only once.
public static AllItemsAreUnique ( IEnumerable collection, string message ) : void
collection IEnumerable IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

AreEqual() публичный статический Метод

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order.
public static AreEqual ( IEnumerable expected, IEnumerable actual ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
Результат void

AreEqual() публичный статический Метод

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order. If comparer is not null then it will be used to compare the objects.
public static AreEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
comparer IComparer The IComparer to use in comparing objects from each IEnumerable
Результат void

AreEqual() публичный статический Метод

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order. If comparer is not null then it will be used to compare the objects.
public static AreEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
comparer IComparer The IComparer to use in comparing objects from each IEnumerable
message string The message that will be displayed on failure
Результат void

AreEqual() публичный статический Метод

Asserts that expected and actual are exactly equal. The collections must have the same count, and contain the exact same objects in the same order.
public static AreEqual ( IEnumerable expected, IEnumerable actual, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

AreEquivalent() публичный статический Метод

Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
public static AreEquivalent ( IEnumerable expected, IEnumerable actual ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
Результат void

AreEquivalent() публичный статический Метод

Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
public static AreEquivalent ( IEnumerable expected, IEnumerable actual, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

AreNotEqual() публичный статический Метод

Asserts that expected and actual are not exactly equal.
public static AreNotEqual ( IEnumerable expected, IEnumerable actual ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
Результат void

AreNotEqual() публичный статический Метод

Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects.
public static AreNotEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
comparer IComparer The IComparer to use in comparing objects from each IEnumerable
Результат void

AreNotEqual() публичный статический Метод

Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects.
public static AreNotEqual ( IEnumerable expected, IEnumerable actual, IComparer comparer, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
comparer IComparer The IComparer to use in comparing objects from each IEnumerable
message string The message that will be displayed on failure
Результат void

AreNotEqual() публичный статический Метод

Asserts that expected and actual are not exactly equal.
public static AreNotEqual ( IEnumerable expected, IEnumerable actual, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

AreNotEquivalent() публичный статический Метод

Asserts that expected and actual are not equivalent.
public static AreNotEquivalent ( IEnumerable expected, IEnumerable actual ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
Результат void

AreNotEquivalent() публичный статический Метод

Asserts that expected and actual are not equivalent.
public static AreNotEquivalent ( IEnumerable expected, IEnumerable actual, string message ) : void
expected IEnumerable The first IEnumerable of objects to be considered
actual IEnumerable The second IEnumerable of objects to be considered
message string The message that will be displayed on failure
Результат void

Contains() публичный статический Метод

Asserts that collection contains actual as an item.
public static Contains ( IEnumerable collection, Object actual ) : void
collection IEnumerable IEnumerable of objects to be considered
actual Object Object to be found within collection
Результат void

Contains() публичный статический Метод

Asserts that collection contains actual as an item.
public static Contains ( IEnumerable collection, Object actual, string message ) : void
collection IEnumerable IEnumerable of objects to be considered
actual Object Object to be found within collection
message string The message that will be displayed on failure
Результат void

DoesNotContain() публичный статический Метод

Asserts that collection does not contain actual as an item.
public static DoesNotContain ( IEnumerable collection, Object actual ) : void
collection IEnumerable IEnumerable of objects to be considered
actual Object Object that cannot exist within collection
Результат void

DoesNotContain() публичный статический Метод

Asserts that collection does not contain actual as an item.
public static DoesNotContain ( IEnumerable collection, Object actual, string message ) : void
collection IEnumerable IEnumerable of objects to be considered
actual Object Object that cannot exist within collection
message string The message that will be displayed on failure
Результат void

IsEmpty() публичный статический Метод

Assert that an array,list or other collection is empty
public static IsEmpty ( IEnumerable collection ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
Результат void

IsEmpty() публичный статический Метод

Assert that an array, list or other collection is empty
public static IsEmpty ( IEnumerable collection, string message ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
message string The message to be displayed on failure
Результат void

IsNotEmpty() публичный статический Метод

Assert that an array,list or other collection is empty
public static IsNotEmpty ( IEnumerable collection ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
Результат void

IsNotEmpty() публичный статический Метод

Assert that an array, list or other collection is empty
public static IsNotEmpty ( IEnumerable collection, string message ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
message string The message to be displayed on failure
Результат void

IsNotSubsetOf() публичный статический Метод

Asserts that the superset does not contain the subset
public static IsNotSubsetOf ( IEnumerable subset, IEnumerable superset ) : void
subset IEnumerable The IEnumerable subset to be considered
superset IEnumerable The IEnumerable superset to be considered
Результат void

IsNotSubsetOf() публичный статический Метод

Asserts that the superset does not contain the subset
public static IsNotSubsetOf ( IEnumerable subset, IEnumerable superset, string message ) : void
subset IEnumerable The IEnumerable subset to be considered
superset IEnumerable The IEnumerable superset to be considered
message string The message that will be displayed on failure
Результат void

IsNotSupersetOf() публичный статический Метод

Asserts that the subset does not contain the superset
public static IsNotSupersetOf ( IEnumerable superset, IEnumerable subset ) : void
superset IEnumerable The IEnumerable superset to be considered
subset IEnumerable The IEnumerable subset to be considered
Результат void

IsNotSupersetOf() публичный статический Метод

Asserts that the subset does not contain the superset
public static IsNotSupersetOf ( IEnumerable superset, IEnumerable subset, string message ) : void
superset IEnumerable The IEnumerable superset to be considered
subset IEnumerable The IEnumerable subset to be considered
message string The message that will be displayed on failure
Результат void

IsOrdered() публичный статический Метод

Assert that an array, list or other collection is ordered
public static IsOrdered ( IEnumerable collection ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
Результат void

IsOrdered() публичный статический Метод

Assert that an array, list or other collection is ordered
public static IsOrdered ( IEnumerable collection, IComparer comparer ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
comparer IComparer A custom comparer to perform the comparisons
Результат void

IsOrdered() публичный статический Метод

Assert that an array, list or other collection is ordered
public static IsOrdered ( IEnumerable collection, IComparer comparer, string message ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
comparer IComparer A custom comparer to perform the comparisons
message string The message to be displayed on failure
Результат void

IsOrdered() публичный статический Метод

Assert that an array, list or other collection is ordered
public static IsOrdered ( IEnumerable collection, string message ) : void
collection IEnumerable An array, list or other collection implementing IEnumerable
message string The message to be displayed on failure
Результат void

IsSubsetOf() публичный статический Метод

Asserts that the superset contains the subset.
public static IsSubsetOf ( IEnumerable subset, IEnumerable superset ) : void
subset IEnumerable The IEnumerable subset to be considered
superset IEnumerable The IEnumerable superset to be considered
Результат void

IsSubsetOf() публичный статический Метод

Asserts that the superset contains the subset.
public static IsSubsetOf ( IEnumerable subset, IEnumerable superset, string message ) : void
subset IEnumerable The IEnumerable subset to be considered
superset IEnumerable The IEnumerable superset to be considered
message string The message that will be displayed on failure
Результат void

IsSupersetOf() публичный статический Метод

Asserts that the subset contains the superset.
public static IsSupersetOf ( IEnumerable superset, IEnumerable subset ) : void
superset IEnumerable The IEnumerable superset to be considered
subset IEnumerable The IEnumerable subset to be considered
Результат void

IsSupersetOf() публичный статический Метод

Asserts that the subset contains the superset.
public static IsSupersetOf ( IEnumerable superset, IEnumerable subset, string message ) : void
superset IEnumerable The IEnumerable superset to be considered
subset IEnumerable The IEnumerable subset to be considered
message string The message that will be displayed on failure
Результат void

ReferenceEquals() публичный статический Метод

DO NOT USE! The ReferenceEquals method throws an InvalidOperationException. This is done to make sure there is no mistake by calling this function.
public static ReferenceEquals ( object a, object b ) : void
a object
b object
Результат void