Assert.ContainsAll 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ContainsAll(IEnumerable, IEnumerable, String, String, String)
- Source:
- Assert.ContainsAll.cs
测试是否 collection 包含(具有多重性)的每个元素 expected ,并在发生任何元素时引发异常(如果任何元素的 expected 发生次数超过在内 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 = "")
参数
- expected
- IEnumerable
应存在于 collection其中的项目集合。
- collection
- IEnumerable
应包含每个项的 expected集合。
- message
- String
当找不到元素时 expected (具有足够多重性)时,要包含在异常中的 collection消息。 消息显示在测试结果中。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
例外
如果 expected 至少包含一个元素,则引发该元素的发生次数超过 in collection。
注解
元素多重性非常重要: [1] 不包含所有 [1, 1]元素。
适用于
ContainsAll(IEnumerable, IEnumerable, IEqualityComparer, String, String, String)
- Source:
- Assert.ContainsAll.cs
测试是否 collection 包含(具有多重性)的每个元素 expected ,并在发生任何元素时引发异常(如果任何元素的 expected 发生次数超过在内 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 = "")
参数
- expected
- IEnumerable
应存在于 collection其中的项目集合。
- collection
- IEnumerable
应包含每个项的 expected集合。
- comparer
- IEqualityComparer
比较元素时要使用的相等比较器。
- message
- String
当找不到元素时 expected (具有足够多重性)时,要包含在异常中的 collection消息。 消息显示在测试结果中。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
例外
如果 expected 至少包含一个元素,则引发该元素的发生次数超过 in collection。
注解
元素多重性非常重要: [1] 不包含所有 [1, 1]元素。
适用于
ContainsAll<T>(Span<T>, Span<T>, IEqualityComparer<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- Span<T>
预计所有项的跨度都存在于 collection其中。
- collection
- Span<T>
应包含每个项的 expected跨度。
- comparer
- IEqualityComparer<T>
比较元素时要使用的相等比较器。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- ReadOnlySpan<T>
预计所有项的跨度都存在于 collection其中。
- collection
- ReadOnlySpan<T>
应包含每个项的 expected跨度。
- comparer
- IEqualityComparer<T>
比较元素时要使用的相等比较器。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, IEqualityComparer<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- ReadOnlyMemory<T>
所有项的内存都存在于 collection其中。
- collection
- ReadOnlyMemory<T>
应包含每个项的 expected内存。
- comparer
- IEqualityComparer<T>
比较元素时要使用的相等比较器。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(Memory<T>, Memory<T>, IEqualityComparer<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- Memory<T>
所有项的内存都存在于 collection其中。
- collection
- Memory<T>
应包含每个项的 expected内存。
- comparer
- IEqualityComparer<T>
比较元素时要使用的相等比较器。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>, String, String, String)
- Source:
- Assert.ContainsAll.cs
测试是否 collection 包含(具有多重性)的每个元素 expected ,并在发生任何元素时引发异常(如果任何元素的 expected 发生次数超过在内 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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- IEnumerable<T>
应存在于 collection其中的项目集合。
- collection
- IEnumerable<T>
应包含每个项的 expected集合。
- comparer
- IEqualityComparer<T>
比较元素时要使用的相等比较器。
- message
- String
当找不到元素时 expected (具有足够多重性)时,要包含在异常中的 collection消息。 消息显示在测试结果中。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
例外
如果 expected 至少包含一个元素,则引发该元素的发生次数超过 in collection。
注解
元素多重性非常重要: [1] 不包含所有 [1, 1]元素。
适用于
ContainsAll<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- ReadOnlySpan<T>
预计所有项的跨度都存在于 collection其中。
- collection
- ReadOnlySpan<T>
应包含每个项的 expected跨度。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- ReadOnlyMemory<T>
所有项的内存都存在于 collection其中。
- collection
- ReadOnlyMemory<T>
应包含每个项的 expected内存。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(Memory<T>, Memory<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- Memory<T>
所有项的内存都存在于 collection其中。
- collection
- Memory<T>
应包含每个项的 expected内存。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
适用于
ContainsAll<T>(IEnumerable<T>, IEnumerable<T>, String, String, String)
- Source:
- Assert.ContainsAll.cs
测试是否 collection 包含(具有多重性)的每个元素 expected ,并在发生任何元素时引发异常(如果任何元素的 expected 发生次数超过在内 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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- IEnumerable<T>
应存在于 collection其中的项目集合。
- collection
- IEnumerable<T>
应包含每个项的 expected集合。
- message
- String
当找不到元素时 expected (具有足够多重性)时,要包含在异常中的 collection消息。 消息显示在测试结果中。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。
例外
如果 expected 至少包含一个元素,则引发该元素的发生次数超过 in collection。
注解
元素多重性非常重要: [1] 不包含所有 [1, 1]元素。
适用于
ContainsAll<T>(Span<T>, Span<T>, String, String, String)
测试是否 collection 包含每个元素 expected (具有多重性)。
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 = "")
类型参数
- T
集合项的类型。
参数
- expected
- Span<T>
预计所有项的跨度都存在于 collection其中。
- collection
- Span<T>
应包含每个项的 expected跨度。
- message
- String
断言失败时要包含在异常中的消息。
- expectedExpression
- String
编译器通过调用方参数表达式给出的预期语法表达式。 用户不应传递此参数的值。
- collectionExpression
- String
编译器通过调用方参数表达式提供的集合的语法表达式。 用户不应传递此参数的值。