Assert.AreAllDistinct Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| AreAllDistinct(IEnumerable, String, String) |
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal. |
| AreAllDistinct(IEnumerable, IEqualityComparer, String, String) |
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied |
| AreAllDistinct<T>(IEnumerable<T>, String, String) |
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal. |
| AreAllDistinct<T>(IEnumerable<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied |
AreAllDistinct(IEnumerable, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal.
public static void AreAllDistinct(System.Collections.IEnumerable? collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : System.Collections.IEnumerable * string * string -> unit
Public Shared Sub AreAllDistinct (collection As IEnumerable, Optional message As String = "", Optional collectionExpression As String = "")
Parameters
- collection
- IEnumerable
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.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct(IEnumerable, IEqualityComparer, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied comparer and throws
an exception if any two elements in the collection are equal.
public static void AreAllDistinct(System.Collections.IEnumerable? collection, System.Collections.IEqualityComparer? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : System.Collections.IEnumerable * System.Collections.IEqualityComparer * string * string -> unit
Public Shared Sub AreAllDistinct (collection As IEnumerable, comparer As IEqualityComparer, Optional message As String = "", Optional collectionExpression As String = "")
Parameters
- collection
- IEnumerable
The collection in which to search for duplicate elements.
- comparer
- IEqualityComparer
The equality comparer to use when comparing 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.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct<T>(IEnumerable<T>, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal.
public static void AreAllDistinct<T>(System.Collections.Generic.IEnumerable<T>? collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : seq<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As IEnumerable(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the collection items.
Parameters
- collection
- IEnumerable<T>
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.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct<T>(IEnumerable<T>, IEqualityComparer<T>, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied comparer and throws
an exception if any two elements in the collection are equal.
public static void AreAllDistinct<T>(System.Collections.Generic.IEnumerable<T>? collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the collection items.
Parameters
- collection
- IEnumerable<T>
The collection in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing 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.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.