C# Class NUnit.Framework.CollectionAssert

Mostrar archivo Open project: nunit/nunit Class Usage Examples

Public Methods

Method 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

Method Description
Equals ( object a, object b ) : bool

Method Details

AllItemsAreInstancesOfType() public static method

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
return void

AllItemsAreInstancesOfType() public static method

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
return void

AllItemsAreNotNull() public static method

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
return void

AllItemsAreNotNull() public static method

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
return void

AllItemsAreUnique() public static method

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
return void

AllItemsAreUnique() public static method

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
return void

AreEqual() public static method

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
return void

AreEqual() public static method

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
return void

AreEqual() public static method

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
return void

AreEqual() public static method

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
return void

AreEquivalent() public static method

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
return void

AreEquivalent() public static method

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
return void

AreNotEqual() public static method

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
return void

AreNotEqual() public static method

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
return void

AreNotEqual() public static method

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
return void

AreNotEqual() public static method

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
return void

AreNotEquivalent() public static method

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
return void

AreNotEquivalent() public static method

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
return void

Contains() public static method

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
return void

Contains() public static method

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
return void

DoesNotContain() public static method

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
return void

DoesNotContain() public static method

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
return void

IsEmpty() public static method

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
return void

IsEmpty() public static method

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
return void

IsNotEmpty() public static method

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
return void

IsNotEmpty() public static method

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
return void

IsNotSubsetOf() public static method

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
return void

IsNotSubsetOf() public static method

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
return void

IsNotSupersetOf() public static method

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
return void

IsNotSupersetOf() public static method

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
return void

IsOrdered() public static method

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
return void

IsOrdered() public static method

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
return void

IsOrdered() public static method

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
return void

IsOrdered() public static method

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
return void

IsSubsetOf() public static method

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
return void

IsSubsetOf() public static method

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
return void

IsSupersetOf() public static method

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
return void

IsSupersetOf() public static method

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
return void

ReferenceEquals() public static method

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
return void