Udostępnij za pośrednictwem


CollectionAssert.AreEqual Method

Definition

Overloads

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

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

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual, System::Collections::IComparer ^ comparer, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual, System.Collections.IComparer comparer, string message, params object[] parameters);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection * System.Collections.IComparer * string * obj[] -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection, comparer As IComparer, message As String, ParamArray parameters As Object())

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

comparer
IComparer

The compare implementation to use when comparing elements of the collection.

message
String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

Applies to

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.

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual, string message, params object[] parameters);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection * string * obj[] -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection, message As String, ParamArray parameters As Object())

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

message
String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

Applies to

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.

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual, System::Collections::IComparer ^ comparer, System::String ^ message);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual, System.Collections.IComparer comparer, string message);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection * System.Collections.IComparer * string -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection, comparer As IComparer, message As String)

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

comparer
IComparer

The compare implementation to use when comparing elements of the collection.

message
String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

Applies to

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.

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual, System::Collections::IComparer ^ comparer);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual, System.Collections.IComparer comparer);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection * System.Collections.IComparer -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection, comparer As IComparer)

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

comparer
IComparer

The compare implementation to use when comparing elements of the collection.

Exceptions

Thrown if expected is not equal to actual.

Applies to

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.

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection)

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

Exceptions

Thrown if expected is not equal to actual.

Applies to

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.

public:
 static void AreEqual(System::Collections::ICollection ^ expected, System::Collections::ICollection ^ actual, System::String ^ message);
public static void AreEqual (System.Collections.ICollection expected, System.Collections.ICollection actual, string message);
static member AreEqual : System.Collections.ICollection * System.Collections.ICollection * string -> unit
Public Shared Sub AreEqual (expected As ICollection, actual As ICollection, message As String)

Parameters

expected
ICollection

The first collection to compare. This is the collection the tests expects.

actual
ICollection

The second collection to compare. This is the collection produced by the code under test.

message
String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

Applies to