Language

Assert.AreAllOfType Method

Definition

Overloads

Name Description
AreAllOfType(Type, IEnumerable, String, String, String)

Tests whether all elements in the specified collection are instances of (or derived from) the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements, or if any element is null.

AreAllOfType<TExpected,TItem>(ReadOnlyMemory<TItem>, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) TExpected.

AreAllOfType<TExpected,TItem>(Span<TItem>, String, String)

Tests whether all elements in the specified span are instances of (or derived from) TExpected.

AreAllOfType<TExpected,TItem>(ReadOnlySpan<TItem>, String, String)

Tests whether all elements in the specified span are instances of (or derived from) TExpected.

AreAllOfType<TExpected,TItem>(Memory<TItem>, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) TExpected.

AreAllOfType<TExpected>(IEnumerable, String, String)

Tests whether all elements in the specified collection are instances of (or derived from) the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements, or if any element is null.

AreAllOfType<TItem>(Type, ReadOnlyMemory<TItem>, String, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) the expected type.

AreAllOfType<TItem>(Type, ReadOnlySpan<TItem>, String, String, String)

Tests whether all elements in the specified span are instances of (or derived from) the expected type.

AreAllOfType<TItem>(Type, Memory<TItem>, String, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) the expected type.

AreAllOfType<TItem>(Type, Span<TItem>, String, String, String)

Tests whether all elements in the specified span are instances of (or derived from) the expected type.

AreAllOfType(Type, IEnumerable, String, String, String)

Source:
Assert.AreAllOfType.cs

Tests whether all elements in the specified collection are instances of (or derived from) the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements, or if any element is null.

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

Parameters

expectedType
Type

The expected type of each element of collection.

collection
IEnumerable

The collection containing elements the test expects to be of the specified type.

message
String

The message to include in the exception when an element in collection is null or not an instance of expectedType. The message is shown in test results.

expectedTypeExpression
String

The syntactic expression of expectedType 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 expectedType or collection is null, or some elements of collection are null or do not inherit from / implement expectedType.

Applies to

AreAllOfType<TExpected,TItem>(ReadOnlyMemory<TItem>, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) TExpected.

public static void AreAllOfType<TExpected,TItem>(ReadOnlyMemory<TItem> collection, string? message = "", string collectionExpression = "");
static member AreAllOfType : ReadOnlyMemory<'Item> * string * string -> unit
Public Shared Sub AreAllOfType(Of TExpected, TItem) (collection As ReadOnlyMemory(Of TItem), Optional message As String = "", Optional collectionExpression As String = "")

Type Parameters

TExpected

The type each element of collection is expected to be.

TItem

The element type of the memory.

Parameters

collection
ReadOnlyMemory<TItem>

The memory containing elements the test expects to be of the specified type.

message
String

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

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

AreAllOfType<TExpected,TItem>(Span<TItem>, String, String)

Tests whether all elements in the specified span are instances of (or derived from) TExpected.

public static void AreAllOfType<TExpected,TItem>(Span<TItem> collection, string? message = "", string collectionExpression = "");
static member AreAllOfType : Span<'Item> * string * string -> unit
Public Shared Sub AreAllOfType(Of TExpected, TItem) (collection As Span(Of TItem), Optional message As String = "", Optional collectionExpression As String = "")

Type Parameters

TExpected

The type each element of collection is expected to be.

TItem

The element type of the span.

Parameters

collection
Span<TItem>

The span containing elements the test expects to be of the specified type.

message
String

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

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

AreAllOfType<TExpected,TItem>(ReadOnlySpan<TItem>, String, String)

Tests whether all elements in the specified span are instances of (or derived from) TExpected.

public static void AreAllOfType<TExpected,TItem>(ReadOnlySpan<TItem> collection, string? message = "", string collectionExpression = "");
static member AreAllOfType : ReadOnlySpan<'Item> * string * string -> unit
Public Shared Sub AreAllOfType(Of TExpected, TItem) (collection As ReadOnlySpan(Of TItem), Optional message As String = "", Optional collectionExpression As String = "")

Type Parameters

TExpected

The type each element of collection is expected to be.

TItem

The element type of the span.

Parameters

collection
ReadOnlySpan<TItem>

The span containing elements the test expects to be of the specified type.

message
String

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

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

AreAllOfType<TExpected,TItem>(Memory<TItem>, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) TExpected.

public static void AreAllOfType<TExpected,TItem>(Memory<TItem> collection, string? message = "", string collectionExpression = "");
static member AreAllOfType : Memory<'Item> * string * string -> unit
Public Shared Sub AreAllOfType(Of TExpected, TItem) (collection As Memory(Of TItem), Optional message As String = "", Optional collectionExpression As String = "")

Type Parameters

TExpected

The type each element of collection is expected to be.

TItem

The element type of the memory.

Parameters

collection
Memory<TItem>

The memory containing elements the test expects to be of the specified type.

message
String

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

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

AreAllOfType<TExpected>(IEnumerable, String, String)

Source:
Assert.AreAllOfType.cs

Tests whether all elements in the specified collection are instances of (or derived from) the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements, or if any element is null.

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

Type Parameters

TExpected

The type each element of collection is expected to be.

Parameters

collection
IEnumerable

The collection containing elements the test expects to be of the specified type.

message
String

The message to include in the exception when an element in collection is null or not an instance of TExpected. 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 some elements of collection are null or do not inherit from / implement TExpected.

Applies to

AreAllOfType<TItem>(Type, ReadOnlyMemory<TItem>, String, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) the expected type.

public static void AreAllOfType<TItem>(Type? expectedType, ReadOnlyMemory<TItem> collection, string? message = "", string expectedTypeExpression = "", string collectionExpression = "");
static member AreAllOfType : Type * ReadOnlyMemory<'Item> * string * string * string -> unit
Public Shared Sub AreAllOfType(Of TItem) (expectedType As Type, collection As ReadOnlyMemory(Of TItem), Optional message As String = "", Optional expectedTypeExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

TItem

The element type of the memory.

Parameters

expectedType
Type

The expected type of each element of collection.

collection
ReadOnlyMemory<TItem>

The memory containing elements the test expects to be of the specified type.

message
String

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

expectedTypeExpression
String

The syntactic expression of expectedType 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

AreAllOfType<TItem>(Type, ReadOnlySpan<TItem>, String, String, String)

Tests whether all elements in the specified span are instances of (or derived from) the expected type.

public static void AreAllOfType<TItem>(Type? expectedType, ReadOnlySpan<TItem> collection, string? message = "", string expectedTypeExpression = "", string collectionExpression = "");
static member AreAllOfType : Type * ReadOnlySpan<'Item> * string * string * string -> unit
Public Shared Sub AreAllOfType(Of TItem) (expectedType As Type, collection As ReadOnlySpan(Of TItem), Optional message As String = "", Optional expectedTypeExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

TItem

The element type of the span.

Parameters

expectedType
Type

The expected type of each element of collection.

collection
ReadOnlySpan<TItem>

The span containing elements the test expects to be of the specified type.

message
String

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

expectedTypeExpression
String

The syntactic expression of expectedType 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

AreAllOfType<TItem>(Type, Memory<TItem>, String, String, String)

Tests whether all elements in the specified memory are instances of (or derived from) the expected type.

public static void AreAllOfType<TItem>(Type? expectedType, Memory<TItem> collection, string? message = "", string expectedTypeExpression = "", string collectionExpression = "");
static member AreAllOfType : Type * Memory<'Item> * string * string * string -> unit
Public Shared Sub AreAllOfType(Of TItem) (expectedType As Type, collection As Memory(Of TItem), Optional message As String = "", Optional expectedTypeExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

TItem

The element type of the memory.

Parameters

expectedType
Type

The expected type of each element of collection.

collection
Memory<TItem>

The memory containing elements the test expects to be of the specified type.

message
String

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

expectedTypeExpression
String

The syntactic expression of expectedType 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

AreAllOfType<TItem>(Type, Span<TItem>, String, String, String)

Tests whether all elements in the specified span are instances of (or derived from) the expected type.

public static void AreAllOfType<TItem>(Type? expectedType, Span<TItem> collection, string? message = "", string expectedTypeExpression = "", string collectionExpression = "");
static member AreAllOfType : Type * Span<'Item> * string * string * string -> unit
Public Shared Sub AreAllOfType(Of TItem) (expectedType As Type, collection As Span(Of TItem), Optional message As String = "", Optional expectedTypeExpression As String = "", Optional collectionExpression As String = "")

Type Parameters

TItem

The element type of the span.

Parameters

expectedType
Type

The expected type of each element of collection.

collection
Span<TItem>

The span containing elements the test expects to be of the specified type.

message
String

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

expectedTypeExpression
String

The syntactic expression of expectedType 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