次の方法で共有


Assert.IsInstanceOfType Method

Definition

Overloads

IsInstanceOfType(Object, Type)

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

IsInstanceOfType(Object, Type, String)

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

IsInstanceOfType(Object, Type, String, Object[])

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

IsInstanceOfType(Object, Type)

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

public:
 static void IsInstanceOfType(System::Object ^ value, Type ^ expectedType);
public static void IsInstanceOfType (object value, Type expectedType);
static member IsInstanceOfType : obj * Type -> unit
Public Shared Sub IsInstanceOfType (value As Object, expectedType As Type)

Parameters

value
Object

The object the test expects to be of the specified type.

expectedType
Type

The expected type of value.

Exceptions

Thrown if value is null or expectedType is not in the inheritance hierarchy of value.

Applies to

IsInstanceOfType(Object, Type, String)

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

public:
 static void IsInstanceOfType(System::Object ^ value, Type ^ expectedType, System::String ^ message);
public static void IsInstanceOfType (object value, Type expectedType, string message);
static member IsInstanceOfType : obj * Type * string -> unit
Public Shared Sub IsInstanceOfType (value As Object, expectedType As Type, message As String)

Parameters

value
Object

The object the test expects to be of the specified type.

expectedType
Type

The expected type of value.

message
String

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

Exceptions

Thrown if value is null or expectedType is not in the inheritance hierarchy of value.

Applies to

IsInstanceOfType(Object, Type, String, Object[])

Tests whether the specified object is an instance of the expected type and throws an exception if the expected type is not in the inheritance hierarchy of the object.

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

Parameters

value
Object

The object the test expects to be of the specified type.

expectedType
Type

The expected type of value.

message
String

The message to include in the exception when value 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 value is null or expectedType is not in the inheritance hierarchy of value.

Applies to