C# Class NUnit.Framework.CollectionAssert

Afficher le fichier Open project: nunit/nunit Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
Equals ( object a, object b ) : bool

Method Details

AllItemsAreInstancesOfType() public static méthode

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
Résultat void

AllItemsAreInstancesOfType() public static méthode

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
Résultat void

AllItemsAreNotNull() public static méthode

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
Résultat void

AllItemsAreNotNull() public static méthode

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
Résultat void

AllItemsAreUnique() public static méthode

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
Résultat void

AllItemsAreUnique() public static méthode

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
Résultat void

AreEqual() public static méthode

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
Résultat void

AreEqual() public static méthode

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
Résultat void

AreEqual() public static méthode

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
Résultat void

AreEqual() public static méthode

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
Résultat void

AreEquivalent() public static méthode

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
Résultat void

AreEquivalent() public static méthode

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
Résultat void

AreNotEqual() public static méthode

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
Résultat void

AreNotEqual() public static méthode

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
Résultat void

AreNotEqual() public static méthode

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
Résultat void

AreNotEqual() public static méthode

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
Résultat void

AreNotEquivalent() public static méthode

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
Résultat void

AreNotEquivalent() public static méthode

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
Résultat void

Contains() public static méthode

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
Résultat void

Contains() public static méthode

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
Résultat void

DoesNotContain() public static méthode

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
Résultat void

DoesNotContain() public static méthode

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
Résultat void

IsEmpty() public static méthode

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
Résultat void

IsEmpty() public static méthode

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
Résultat void

IsNotEmpty() public static méthode

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
Résultat void

IsNotEmpty() public static méthode

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
Résultat void

IsNotSubsetOf() public static méthode

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
Résultat void

IsNotSubsetOf() public static méthode

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
Résultat void

IsNotSupersetOf() public static méthode

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
Résultat void

IsNotSupersetOf() public static méthode

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
Résultat void

IsOrdered() public static méthode

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
Résultat void

IsOrdered() public static méthode

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
Résultat void

IsOrdered() public static méthode

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
Résultat void

IsOrdered() public static méthode

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
Résultat void

IsSubsetOf() public static méthode

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
Résultat void

IsSubsetOf() public static méthode

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
Résultat void

IsSupersetOf() public static méthode

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
Résultat void

IsSupersetOf() public static méthode

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
Résultat void

ReferenceEquals() public static méthode

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
Résultat void