Language

Assert.ContainsAll Method

Definition

Overloads

Name Description
ContainsAll(IEnumerable, IEnumerable, String, String, String)

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

ContainsAll(IEnumerable, IEnumerable, IEqualityComparer, String, String, String)

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

ContainsAll<T>(Span<T>, Span<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(Memory<T>, Memory<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(Memory<T>, Memory<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

ContainsAll<T>(Span<T>, Span<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

ContainsAll(IEnumerable, IEnumerable, String, String, String)

Source:
Assert.ContainsAll.cs

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

public static void ContainsAll(System.Collections.IEnumerable? expected, System.Collections.IEnumerable? collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : System.Collections.IEnumerable * System.Collections.IEnumerable * string * string * string -> unit
Public Shared Sub ContainsAll (expected As IEnumerable, collection As IEnumerable, Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Parameters

expected
IEnumerable

The collection of items expected to all be present in collection.

collection
IEnumerable

The collection expected to contain every item of expected.

message
String

The message to include in the exception when an element in expected is not found (with sufficient multiplicity) in collection. The message is shown in test results.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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 expected contains at least one element that occurs more times than in collection.

Remarks

Element multiplicity is significant: [1] does not contain all of [1, 1].

Applies to

ContainsAll(IEnumerable, IEnumerable, IEqualityComparer, String, String, String)

Source:
Assert.ContainsAll.cs

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

public static void ContainsAll(System.Collections.IEnumerable? expected, System.Collections.IEnumerable? collection, System.Collections.IEqualityComparer? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : System.Collections.IEnumerable * System.Collections.IEnumerable * System.Collections.IEqualityComparer * string * string * string -> unit
Public Shared Sub ContainsAll (expected As IEnumerable, collection As IEnumerable, comparer As IEqualityComparer, Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Parameters

expected
IEnumerable

The collection of items expected to all be present in collection.

collection
IEnumerable

The collection expected to contain every item of expected.

comparer
IEqualityComparer

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when an element in expected is not found (with sufficient multiplicity) in collection. The message is shown in test results.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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 expected contains at least one element that occurs more times than in collection.

Remarks

Element multiplicity is significant: [1] does not contain all of [1, 1].

Applies to

ContainsAll<T>(Span<T>, Span<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(Span<T> expected, Span<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : Span<'T> * Span<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As Span(Of T), collection As Span(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
Span<T>

The span of items expected to all be present in collection.

collection
Span<T>

The span expected to contain every item of expected.

comparer
IEqualityComparer<T>

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As ReadOnlySpan(Of T), collection As ReadOnlySpan(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
ReadOnlySpan<T>

The span of items expected to all be present in collection.

collection
ReadOnlySpan<T>

The span expected to contain every item of expected.

comparer
IEqualityComparer<T>

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(ReadOnlyMemory<T> expected, ReadOnlyMemory<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As ReadOnlyMemory(Of T), collection As ReadOnlyMemory(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
ReadOnlyMemory<T>

The memory of items expected to all be present in collection.

collection
ReadOnlyMemory<T>

The memory expected to contain every item of expected.

comparer
IEqualityComparer<T>

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(Memory<T>, Memory<T>, IEqualityComparer<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(Memory<T> expected, Memory<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : Memory<'T> * Memory<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As Memory(Of T), collection As Memory(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
Memory<T>

The memory of items expected to all be present in collection.

collection
Memory<T>

The memory expected to contain every item of expected.

comparer
IEqualityComparer<T>

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>, String, String, String)

Source:
Assert.ContainsAll.cs

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

public static void ContainsAll<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : seq<'T> * seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As IEnumerable(Of T), collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
IEnumerable<T>

The collection of items expected to all be present in collection.

collection
IEnumerable<T>

The collection expected to contain every item of expected.

comparer
IEqualityComparer<T>

The equality comparer to use when comparing elements.

message
String

The message to include in the exception when an element in expected is not found (with sufficient multiplicity) in collection. The message is shown in test results.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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 expected contains at least one element that occurs more times than in collection.

Remarks

Element multiplicity is significant: [1] does not contain all of [1, 1].

Applies to

ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : ReadOnlySpan<'T> * ReadOnlySpan<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As ReadOnlySpan(Of T), collection As ReadOnlySpan(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
ReadOnlySpan<T>

The span of items expected to all be present in collection.

collection
ReadOnlySpan<T>

The span expected to contain every item of expected.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(ReadOnlyMemory<T> expected, ReadOnlyMemory<T> collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As ReadOnlyMemory(Of T), collection As ReadOnlyMemory(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
ReadOnlyMemory<T>

The memory of items expected to all be present in collection.

collection
ReadOnlyMemory<T>

The memory expected to contain every item of expected.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(Memory<T>, Memory<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(Memory<T> expected, Memory<T> collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : Memory<'T> * Memory<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As Memory(Of T), collection As Memory(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
Memory<T>

The memory of items expected to all be present in collection.

collection
Memory<T>

The memory expected to contain every item of expected.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to

ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, String, String, String)

Source:
Assert.ContainsAll.cs

Tests whether collection contains every element of expected (with multiplicity) and throws an exception if any element in expected occurs more times than in collection.

public static void ContainsAll<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : seq<'T> * seq<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As IEnumerable(Of T), collection As IEnumerable(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
IEnumerable<T>

The collection of items expected to all be present in collection.

collection
IEnumerable<T>

The collection expected to contain every item of expected.

message
String

The message to include in the exception when an element in expected is not found (with sufficient multiplicity) in collection. The message is shown in test results.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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 expected contains at least one element that occurs more times than in collection.

Remarks

Element multiplicity is significant: [1] does not contain all of [1, 1].

Applies to

ContainsAll<T>(Span<T>, Span<T>, String, String, String)

Tests whether collection contains every element of expected (with multiplicity).

public static void ContainsAll<T>(Span<T> expected, Span<T> collection, string? message = "", string expectedExpression = "", string collectionExpression = "");
static member ContainsAll : Span<'T> * Span<'T> * string * string * string -> unit
Public Shared Sub ContainsAll(Of T) (expected As Span(Of T), collection As Span(Of T), Optional message As String = "", Optional expectedExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

T

The type of the collection items.

Parameters

expected
Span<T>

The span of items expected to all be present in collection.

collection
Span<T>

The span expected to contain every item of expected.

message
String

The message to include in the exception when the assertion fails.

expectedExpression
String

The syntactic expression of expected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

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.

Applies to