Assert.ContainsAll 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 |
|---|---|
| ContainsAll(IEnumerable, IEnumerable, String, String, String) |
Tests whether |
| ContainsAll(IEnumerable, IEnumerable, IEqualityComparer, String, String, String) |
Tests whether |
| ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, String, String, String) |
Tests whether |
| ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>, String, String, String) |
Tests whether |
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>(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>(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].