Partager via


CollectionAssert.AllItemsAreInstancesOfType Method

Definition

Overloads

AllItemsAreInstancesOfType(ICollection, Type)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

AllItemsAreInstancesOfType(ICollection, Type, String)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

AllItemsAreInstancesOfType(ICollection, Type, String, Object[])

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

AllItemsAreInstancesOfType(ICollection, Type)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

public:
 static void AllItemsAreInstancesOfType(System::Collections::ICollection ^ collection, Type ^ expectedType);
public static void AllItemsAreInstancesOfType (System.Collections.ICollection collection, Type expectedType);
static member AllItemsAreInstancesOfType : System.Collections.ICollection * Type -> unit
Public Shared Sub AllItemsAreInstancesOfType (collection As ICollection, expectedType As Type)

Parameters

collection
ICollection

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

expectedType
Type

The expected type of each element of collection.

Exceptions

Thrown if an element in collection is null or expectedType is not in the inheritance hierarchy of an element in collection.

Applies to

AllItemsAreInstancesOfType(ICollection, Type, String)

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

public:
 static void AllItemsAreInstancesOfType(System::Collections::ICollection ^ collection, Type ^ expectedType, System::String ^ message);
public static void AllItemsAreInstancesOfType (System.Collections.ICollection collection, Type expectedType, string message);
static member AllItemsAreInstancesOfType : System.Collections.ICollection * Type * string -> unit
Public Shared Sub AllItemsAreInstancesOfType (collection As ICollection, expectedType As Type, message As String)

Parameters

collection
ICollection

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

expectedType
Type

The expected type of each element of collection.

message
String

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

Exceptions

Thrown if an element in collection is null or expectedType is not in the inheritance hierarchy of an element in collection.

Applies to

AllItemsAreInstancesOfType(ICollection, Type, String, Object[])

Tests whether all elements in the specified collection are instances of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of one or more of the elements.

public:
 static void AllItemsAreInstancesOfType(System::Collections::ICollection ^ collection, Type ^ expectedType, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void AllItemsAreInstancesOfType (System.Collections.ICollection collection, Type expectedType, string message, params object[] parameters);
static member AllItemsAreInstancesOfType : System.Collections.ICollection * Type * string * obj[] -> unit
Public Shared Sub AllItemsAreInstancesOfType (collection As ICollection, expectedType As Type, message As String, ParamArray parameters As Object())

Parameters

collection
ICollection

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

expectedType
Type

The expected type of each element of collection.

message
String

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

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if an element in collection is null or expectedType is not in the inheritance hierarchy of an element in collection.

Applies to