Assert.ContainsAll 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ContainsAll(IEnumerable, IEnumerable, String, String, String)
測試是否 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 包含至少一個元素出現次數多於 , collection則 擲出 。
備註
元素重數非常重要: [1] 不包含全部 [1, 1]。
適用於
ContainsAll(IEnumerable, IEnumerable, IEqualityComparer, String, String, String)
測試是否 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 包含至少一個元素出現次數多於 , 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)
測試是否 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 包含至少一個元素出現次數多於 , 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)
測試是否 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 包含至少一個元素出現次數多於 , 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
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。