共用方式為


Assert.IsInstanceOfType Method

Definition

Overloads

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)

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<T>(Object, T, String)

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

IsInstanceOfType<T>(Object, T, String, Object[])

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

IsInstanceOfType<T>(Object, String, Object[])

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

IsInstanceOfType<T>(Object, T)

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

IsInstanceOfType<T>(Object, String)

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

IsInstanceOfType<T>(Object)

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

IsInstanceOfType(Object, Type, String)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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 (object value, Type expectedType, 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)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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 (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, Object[])

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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 (object value, Type expectedType, string message, params 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

IsInstanceOfType<T>(Object, T, String)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value, out T instance, string? message);
static member IsInstanceOfType : obj * 'T * string -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, ByRef instance As T, message As String)

Type Parameters

T

The expected type of value.

Parameters

value
Object
instance
T
message
String

Applies to

IsInstanceOfType<T>(Object, T, String, Object[])

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value, out T instance, string? message, params object?[]? parameters);
static member IsInstanceOfType : obj * 'T * string * obj[] -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, ByRef instance As T, message As String, ParamArray parameters As Object())

Type Parameters

T

The expected type of value.

Parameters

value
Object
instance
T
message
String
parameters
Object[]

Applies to

IsInstanceOfType<T>(Object, String, Object[])

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value, string? message, params object?[]? parameters);
static member IsInstanceOfType : obj * string * obj[] -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, message As String, ParamArray parameters As Object())

Type Parameters

T

The expected type of value.

Parameters

value
Object
message
String
parameters
Object[]

Applies to

IsInstanceOfType<T>(Object, T)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value, out T instance);
static member IsInstanceOfType : obj * 'T -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, ByRef instance As T)

Type Parameters

T

The expected type of value.

Parameters

value
Object
instance
T

Applies to

IsInstanceOfType<T>(Object, String)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value, string? message);
static member IsInstanceOfType : obj * string -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, message As String)

Type Parameters

T

The expected type of value.

Parameters

value
Object
message
String

Applies to

IsInstanceOfType<T>(Object)

Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs
Source:
Assert.IsInstanceOfType.cs

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

public static void IsInstanceOfType<T> (object? value);
static member IsInstanceOfType : obj -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object)

Type Parameters

T

The expected type of value.

Parameters

value
Object

Applies to