IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.CollectionAssert Class Reference

A set of Assert methods operating on one or more collections More...

Static Public Member Functions

static new bool Equals (object a, object b)
 The Equals method throws an AssertionException. This is done to make sure there is no mistake by calling this function. More...
 
static new void ReferenceEquals (object a, object b)
 override the default ReferenceEquals to throw an AssertionException. This implementation makes sure there is no mistake in calling this function as part of Assert. More...
 
static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType)
 Asserts that all items contained in collection are of the type specified by expectedType. More...
 
static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType, string message, params object[] args)
 Asserts that all items contained in collection are of the type specified by expectedType. More...
 
static void AllItemsAreNotNull (IEnumerable collection)
 Asserts that all items contained in collection are not equal to null. More...
 
static void AllItemsAreNotNull (IEnumerable collection, string message, params object[] args)
 Asserts that all items contained in collection are not equal to null. More...
 
static void AllItemsAreUnique (IEnumerable collection)
 Ensures that every object contained in collection exists within the collection once and only once. More...
 
static void AllItemsAreUnique (IEnumerable collection, string message, params object[] args)
 Ensures that every object contained in collection exists within the collection once and only once. More...
 
static void AreEqual (IEnumerable expected, IEnumerable actual)
 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. More...
 
static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer)
 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. More...
 
static void AreEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args)
 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. More...
 
static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args)
 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. More...
 
static void AreEquivalent (IEnumerable expected, IEnumerable actual)
 Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. More...
 
static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args)
 Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. More...
 
static void AreNotEqual (IEnumerable expected, IEnumerable actual)
 Asserts that expected and actual are not exactly equal. More...
 
static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer)
 Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects. More...
 
static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args)
 Asserts that expected and actual are not exactly equal. More...
 
static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args)
 Asserts that expected and actual are not exactly equal. If comparer is not null then it will be used to compare the objects. More...
 
static void AreNotEquivalent (IEnumerable expected, IEnumerable actual)
 Asserts that expected and actual are not equivalent. More...
 
static void AreNotEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args)
 Asserts that expected and actual are not equivalent. More...
 
static void Contains (IEnumerable collection, Object actual)
 Asserts that collection contains actual as an item. More...
 
static void Contains (IEnumerable collection, Object actual, string message, params object[] args)
 Asserts that collection contains actual as an item. More...
 
static void DoesNotContain (IEnumerable collection, Object actual)
 Asserts that collection does not contain actual as an item. More...
 
static void DoesNotContain (IEnumerable collection, Object actual, string message, params object[] args)
 Asserts that collection does not contain actual as an item. More...
 
static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset)
 Asserts that the superset does not contain the subset More...
 
static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)
 Asserts that the superset does not contain the subset More...
 
static void IsSubsetOf (IEnumerable subset, IEnumerable superset)
 Asserts that the superset contains the subset. More...
 
static void IsSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)
 Asserts that the superset contains the subset. More...
 
static void IsNotSupersetOf (IEnumerable superset, IEnumerable subset)
 Asserts that the subset does not contain the superset More...
 
static void IsNotSupersetOf (IEnumerable superset, IEnumerable subset, string message, params object[] args)
 Asserts that the subset does not contain the superset More...
 
static void IsSupersetOf (IEnumerable superset, IEnumerable subset)
 Asserts that the subset contains the superset. More...
 
static void IsSupersetOf (IEnumerable superset, IEnumerable subset, string message, params object[] args)
 Asserts that the subset contains the superset. More...
 
static void IsEmpty (IEnumerable collection, string message, params object[] args)
 Assert that an array, list or other collection is empty More...
 
static void IsEmpty (IEnumerable collection)
 Assert that an array,list or other collection is empty More...
 
static void IsNotEmpty (IEnumerable collection, string message, params object[] args)
 Assert that an array, list or other collection is empty More...
 
static void IsNotEmpty (IEnumerable collection)
 Assert that an array,list or other collection is empty More...
 
static void IsOrdered (IEnumerable collection, string message, params object[] args)
 Assert that an array, list or other collection is ordered More...
 
static void IsOrdered (IEnumerable collection)
 Assert that an array, list or other collection is ordered More...
 
static void IsOrdered (IEnumerable collection, IComparer comparer, string message, params object[] args)
 Assert that an array, list or other collection is ordered More...
 
static void IsOrdered (IEnumerable collection, IComparer comparer)
 Assert that an array, list or other collection is ordered More...
 

Detailed Description

A set of Assert methods operating on one or more collections

Member Function Documentation

static new bool NUnit.Framework.CollectionAssert.Equals ( object  a,
object  b 
)
inlinestatic

The Equals method throws an AssertionException. This is done to make sure there is no mistake by calling this function.

Parameters
a
b
static new void NUnit.Framework.CollectionAssert.ReferenceEquals ( object  a,
object  b 
)
inlinestatic

override the default ReferenceEquals to throw an AssertionException. This implementation makes sure there is no mistake in calling this function as part of Assert.

Parameters
a
b
static void NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType ( IEnumerable  collection,
Type  expectedType 
)
inlinestatic

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

Parameters
collectionIEnumerable containing objects to be considered
expectedTypeSystem.Type that all objects in collection must be instances of

Referenced by NUnit.Framework.Tests.AssertSyntaxTests.AllItemsTests(), NUnit.Framework.Assertions.CollectionAssertTest.ItemsOfType(), and NUnit.Framework.Assertions.CollectionAssertTest.ItemsOfTypeFailure().

static void NUnit.Framework.CollectionAssert.AllItemsAreInstancesOfType ( IEnumerable  collection,
Type  expectedType,
string  message,
params object[]  args 
)
inlinestatic

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

Parameters
collectionIEnumerable containing objects to be considered
expectedTypeSystem.Type that all objects in collection must be instances of
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.All, NUnit.Framework.Constraints.ConstraintExpression.InstanceOf(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.AllItemsAreNotNull ( IEnumerable  collection)
inlinestatic

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

Parameters
collectionIEnumerable containing objects to be considered

Referenced by NUnit.Framework.Tests.AssertSyntaxTests.AllItemsTests(), NUnit.Framework.Assertions.CollectionAssertTest.ItemsNotNull(), and NUnit.Framework.Assertions.CollectionAssertTest.ItemsNotNullFailure().

static void NUnit.Framework.CollectionAssert.AllItemsAreNotNull ( IEnumerable  collection,
string  message,
params object[]  args 
)
inlinestatic

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

Parameters
collectionIEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.All, NUnit.Framework.Constraints.ConstraintExpression.Not, NUnit.Framework.Constraints.ConstraintExpression.Null, and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.AllItemsAreUnique ( IEnumerable  collection)
inlinestatic
static void NUnit.Framework.CollectionAssert.AllItemsAreUnique ( IEnumerable  collection,
string  message,
params object[]  args 
)
inlinestatic

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

Parameters
collectionIEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Assert.That(), and NUnit.Framework.Is.Unique.

static void NUnit.Framework.CollectionAssert.AreEqual ( IEnumerable  expected,
IEnumerable  actual 
)
inlinestatic
static void NUnit.Framework.CollectionAssert.AreEqual ( IEnumerable  expected,
IEnumerable  actual,
IComparer  comparer 
)
inlinestatic

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.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
comparerThe IComparer to use in comparing objects from each IEnumerable
static void NUnit.Framework.CollectionAssert.AreEqual ( IEnumerable  expected,
IEnumerable  actual,
string  message,
params object[]  args 
)
inlinestatic

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.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.EqualTo(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.AreEqual ( IEnumerable  expected,
IEnumerable  actual,
IComparer  comparer,
string  message,
params object[]  args 
)
inlinestatic

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.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
comparerThe IComparer to use in comparing objects from each IEnumerable
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.EqualTo(), NUnit.Framework.Assert.That(), and NUnit.Framework.Constraints.EqualConstraint.Using().

static void NUnit.Framework.CollectionAssert.AreEquivalent ( IEnumerable  expected,
IEnumerable  actual 
)
inlinestatic

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

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered

Referenced by NUnit.Framework.Assertions.CollectionAssertTest.AreEquivalentHandlesNull(), NUnit.Framework.Tests.AssertSyntaxTests.CollectionEquivalenceTests(), NUnit.Framework.Assertions.CollectionAssertTest.Equivalent(), NUnit.Framework.Assertions.CollectionAssertTest.EquivalentFailOne(), and NUnit.Framework.Assertions.CollectionAssertTest.EquivalentFailTwo().

static void NUnit.Framework.CollectionAssert.AreEquivalent ( IEnumerable  expected,
IEnumerable  actual,
string  message,
params object[]  args 
)
inlinestatic

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

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.EquivalentTo(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.AreNotEqual ( IEnumerable  expected,
IEnumerable  actual 
)
inlinestatic

Asserts that expected and actual are not exactly equal.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered

Referenced by NUnit.Framework.Assertions.CollectionAssertTest.AreNotEqual(), NUnit.Framework.Assertions.CollectionAssertTest.AreNotEqual_Fails(), and NUnit.Framework.Assertions.CollectionAssertTest.AreNotEqual_HandlesNull().

static void NUnit.Framework.CollectionAssert.AreNotEqual ( IEnumerable  expected,
IEnumerable  actual,
IComparer  comparer 
)
inlinestatic

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

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
comparerThe IComparer to use in comparing objects from each IEnumerable
static void NUnit.Framework.CollectionAssert.AreNotEqual ( IEnumerable  expected,
IEnumerable  actual,
string  message,
params object[]  args 
)
inlinestatic

Asserts that expected and actual are not exactly equal.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Constraints.ConstraintExpression.EqualTo(), NUnit.Framework.Is.Not, and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.AreNotEqual ( IEnumerable  expected,
IEnumerable  actual,
IComparer  comparer,
string  message,
params object[]  args 
)
inlinestatic

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

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
comparerThe IComparer to use in comparing objects from each IEnumerable
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Constraints.ConstraintExpression.EqualTo(), NUnit.Framework.Is.Not, NUnit.Framework.Assert.That(), and NUnit.Framework.Constraints.EqualConstraint.Using().

static void NUnit.Framework.CollectionAssert.AreNotEquivalent ( IEnumerable  expected,
IEnumerable  actual 
)
inlinestatic

Asserts that expected and actual are not equivalent.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered

Referenced by NUnit.Framework.Tests.AssertSyntaxTests.CollectionEquivalenceTests(), NUnit.Framework.Assertions.CollectionAssertTest.NotEquivalent(), NUnit.Framework.Assertions.CollectionAssertTest.NotEquivalent_Fails(), and NUnit.Framework.Assertions.CollectionAssertTest.NotEquivalentHandlesNull().

static void NUnit.Framework.CollectionAssert.AreNotEquivalent ( IEnumerable  expected,
IEnumerable  actual,
string  message,
params object[]  args 
)
inlinestatic

Asserts that expected and actual are not equivalent.

Parameters
expectedThe first IEnumerable of objects to be considered
actualThe second IEnumerable of objects to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Constraints.ConstraintExpression.EquivalentTo(), NUnit.Framework.Is.Not, and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.Contains ( IEnumerable  collection,
Object  actual,
string  message,
params object[]  args 
)
inlinestatic

Asserts that collection contains actual as an item.

Parameters
collectionIEnumerable of objects to be considered
actualObject to be found within collection
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Has.Member(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.DoesNotContain ( IEnumerable  collection,
Object  actual 
)
inlinestatic

Asserts that collection does not contain actual as an item.

Parameters
collectionIEnumerable of objects to be considered
actualObject that cannot exist within collection

Referenced by NUnit.Framework.Tests.AssertSyntaxTests.CollectionContainsTests(), NUnit.Framework.Assertions.CollectionAssertTest.DoesNotContain(), NUnit.Framework.Assertions.CollectionAssertTest.DoesNotContain_Empty(), and NUnit.Framework.Assertions.CollectionAssertTest.DoesNotContain_Fails().

static void NUnit.Framework.CollectionAssert.DoesNotContain ( IEnumerable  collection,
Object  actual,
string  message,
params object[]  args 
)
inlinestatic

Asserts that collection does not contain actual as an item.

Parameters
collectionIEnumerable of objects to be considered
actualObject that cannot exist within collection
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Constraints.ConstraintExpression.Member(), NUnit.Framework.Has.No, and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.IsNotSubsetOf ( IEnumerable  subset,
IEnumerable  superset 
)
inlinestatic

Asserts that the superset does not contain the subset

Parameters
subsetThe IEnumerable subset to be considered
supersetThe IEnumerable superset to be considered

Referenced by NUnit.Framework.Assertions.CollectionAssertTest.IsNotSubsetOf(), NUnit.Framework.Assertions.CollectionAssertTest.IsNotSubsetOf_Fails(), NUnit.Framework.Assertions.CollectionAssertTest.IsNotSubsetOfHandlesNull(), and NUnit.Framework.Tests.AssertSyntaxTests.SubsetTests().

static void NUnit.Framework.CollectionAssert.IsNotSubsetOf ( IEnumerable  subset,
IEnumerable  superset,
string  message,
params object[]  args 
)
inlinestatic

Asserts that the superset does not contain the subset

Parameters
subsetThe IEnumerable subset to be considered
supersetThe IEnumerable superset to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.Not, NUnit.Framework.Constraints.ConstraintExpression.SubsetOf(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.IsSubsetOf ( IEnumerable  subset,
IEnumerable  superset 
)
inlinestatic

Asserts that the superset contains the subset.

Parameters
subsetThe IEnumerable subset to be considered
supersetThe IEnumerable superset to be considered

Referenced by NUnit.Framework.Assertions.CollectionAssertTest.IsSubsetOf(), NUnit.Framework.Assertions.CollectionAssertTest.IsSubsetOf_Fails(), NUnit.Framework.Assertions.CollectionAssertTest.IsSubsetOfHandlesNull(), and NUnit.Framework.Tests.AssertSyntaxTests.SubsetTests().

static void NUnit.Framework.CollectionAssert.IsSubsetOf ( IEnumerable  subset,
IEnumerable  superset,
string  message,
params object[]  args 
)
inlinestatic

Asserts that the superset contains the subset.

Parameters
subsetThe IEnumerable subset to be considered
supersetThe IEnumerable superset to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.SubsetOf(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.IsNotSupersetOf ( IEnumerable  superset,
IEnumerable  subset 
)
inlinestatic

Asserts that the subset does not contain the superset

Parameters
supersetThe IEnumerable superset to be considered
subsetThe IEnumerable subset to be considered
static void NUnit.Framework.CollectionAssert.IsNotSupersetOf ( IEnumerable  superset,
IEnumerable  subset,
string  message,
params object[]  args 
)
inlinestatic

Asserts that the subset does not contain the superset

Parameters
supersetThe IEnumerable superset to be considered
subsetThe IEnumerable subset to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.Not, NUnit.Framework.Constraints.ConstraintExpression.SupersetOf(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.IsSupersetOf ( IEnumerable  superset,
IEnumerable  subset 
)
inlinestatic

Asserts that the subset contains the superset.

Parameters
supersetThe IEnumerable superset to be considered
subsetThe IEnumerable subset to be considered
static void NUnit.Framework.CollectionAssert.IsSupersetOf ( IEnumerable  superset,
IEnumerable  subset,
string  message,
params object[]  args 
)
inlinestatic

Asserts that the subset contains the superset.

Parameters
supersetThe IEnumerable superset to be considered
subsetThe IEnumerable subset to be considered
messageThe message that will be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.SupersetOf(), and NUnit.Framework.Assert.That().

static void NUnit.Framework.CollectionAssert.IsEmpty ( IEnumerable  collection,
string  message,
params object[]  args 
)
inlinestatic

Assert that an array, list or other collection is empty

Parameters
collectionAn array, list or other collection implementing IEnumerable
messageThe message to be displayed on failure
argsArguments to be used in formatting the message
static void NUnit.Framework.CollectionAssert.IsEmpty ( IEnumerable  collection)
inlinestatic

Assert that an array,list or other collection is empty

Parameters
collectionAn array, list or other collection implementing IEnumerable
static void NUnit.Framework.CollectionAssert.IsNotEmpty ( IEnumerable  collection,
string  message,
params object[]  args 
)
inlinestatic

Assert that an array, list or other collection is empty

Parameters
collectionAn array, list or other collection implementing IEnumerable
messageThe message to be displayed on failure
argsArguments to be used in formatting the message
static void NUnit.Framework.CollectionAssert.IsNotEmpty ( IEnumerable  collection)
inlinestatic

Assert that an array,list or other collection is empty

Parameters
collectionAn array, list or other collection implementing IEnumerable
static void NUnit.Framework.CollectionAssert.IsOrdered ( IEnumerable  collection)
inlinestatic

Assert that an array, list or other collection is ordered

Parameters
collectionAn array, list or other collection implementing IEnumerable
static void NUnit.Framework.CollectionAssert.IsOrdered ( IEnumerable  collection,
IComparer  comparer,
string  message,
params object[]  args 
)
inlinestatic

Assert that an array, list or other collection is ordered

Parameters
collectionAn array, list or other collection implementing IEnumerable
comparerA custom comparer to perform the comparisons
messageThe message to be displayed on failure
argsArguments to be used in formatting the message

References NUnit.Framework.Is.Ordered, NUnit.Framework.Assert.That(), and NUnit.Framework.Constraints.CollectionOrderedConstraint.Using().

static void NUnit.Framework.CollectionAssert.IsOrdered ( IEnumerable  collection,
IComparer  comparer 
)
inlinestatic

Assert that an array, list or other collection is ordered

Parameters
collectionAn array, list or other collection implementing IEnumerable
comparerA custom comparer to perform the comparisons

The documentation for this class was generated from the following file: