Share via


CollectionAssert.AllItemsAreUnique Method

Definition

Overloads

AllItemsAreUnique(ICollection)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

AllItemsAreUnique(ICollection, String)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

AllItemsAreUnique(ICollection, String, Object[])

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

AllItemsAreUnique(ICollection)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

public:
 static void AllItemsAreUnique(System::Collections::ICollection ^ collection);
public static void AllItemsAreUnique (System.Collections.ICollection collection);
static member AllItemsAreUnique : System.Collections.ICollection -> unit
Public Shared Sub AllItemsAreUnique (collection As ICollection)

Parameters

collection
ICollection

The collection in which to search for duplicate elements.

Exceptions

Thrown if a two or more equal elements are found in collection.

Applies to

AllItemsAreUnique(ICollection, String)

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

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

Parameters

collection
ICollection

The collection in which to search for duplicate elements.

message
String

The message to include in the exception when collection contains at least one duplicate element. The message is shown in test results.

Exceptions

Thrown if a two or more equal elements are found in collection.

Applies to

AllItemsAreUnique(ICollection, String, Object[])

Tests whether all items in the specified collection are unique or not and throws if any two elements in the collection are equal.

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

Parameters

collection
ICollection

The collection in which to search for duplicate elements.

message
String

The message to include in the exception when collection contains at least one duplicate element. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if a two or more equal elements are found in collection.

Applies to