Assert.IsInstanceOfType Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| IsInstanceOfType(Object, Type, String, 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, Assert+AssertIsInstanceOfTypeInterpolatedStringHandler, 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, Assert+AssertIsInstanceOfTypeInterpolatedStringHandler) |
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<T>(Object, String, 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) |
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, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<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, 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, 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) |
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, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<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) |
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, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<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(Object, Type, String, String)
- 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 = "", string valueExpression = "");
static member IsInstanceOfType : obj * Type * string * string -> unit
Public Shared Sub IsInstanceOfType (value As Object, expectedType As Type, Optional message As String = "", Optional valueExpression 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.
- valueExpression
- String
The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
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
- 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(Object, Type, Assert+AssertIsInstanceOfTypeInterpolatedStringHandler, String)
- 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, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsInstanceOfTypeInterpolatedStringHandler message, string valueExpression = "");
static member IsInstanceOfType : obj * Type * AssertIsInstanceOfTypeInterpolatedStringHandler * string -> unit
Public Shared Sub IsInstanceOfType (value As Object, expectedType As Type, ByRef message As Assert.AssertIsInstanceOfTypeInterpolatedStringHandler, Optional valueExpression As String = "")
Parameters
- value
- Object
The object the test expects to be of the specified type.
- expectedType
- Type
The expected type of value.
The message to include in the exception when value
is not an instance of expectedType. The message is
shown in test results.
- valueExpression
- String
The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
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
- 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, Assert+AssertIsInstanceOfTypeInterpolatedStringHandler)
- 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, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsInstanceOfTypeInterpolatedStringHandler message);
static member IsInstanceOfType : obj * Type * AssertIsInstanceOfTypeInterpolatedStringHandler -> unit
Public Shared Sub IsInstanceOfType (value As Object, expectedType As Type, ByRef message As Assert.AssertIsInstanceOfTypeInterpolatedStringHandler)
Parameters
- value
- Object
The object the test expects to be of the specified type.
- expectedType
- Type
The expected type of value.
The message to include in the exception when value
is not an instance of expectedType. The message is
shown in test results.
Applies to
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
- 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<T>(Object, String, String)
- 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 T IsInstanceOfType<T>(object? value, string? message = "", string valueExpression = "");
static member IsInstanceOfType : obj * string * string -> 'T
Public Shared Function IsInstanceOfType(Of T) (value As Object, Optional message As String = "", Optional valueExpression As String = "") As T
Type Parameters
- T
The expected type of value.
Parameters
- value
- Object
- message
- String
- valueExpression
- String
Returns
Applies to
IsInstanceOfType<T>(Object, T, 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
- 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, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<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, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<T> message);
static member IsInstanceOfType : obj * 'T * AssertGenericIsInstanceOfTypeInterpolatedStringHandler -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, ByRef instance As T, ByRef message As Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler(Of T))
Type Parameters
- T
The expected type of value.
Parameters
- value
- Object
- instance
- T
Applies to
IsInstanceOfType<T>(Object, T, 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
- 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
- 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, 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
- 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, T)
- 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
- 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, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<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, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<T> message);
static member IsInstanceOfType : obj * AssertGenericIsInstanceOfTypeInterpolatedStringHandler -> unit
Public Shared Sub IsInstanceOfType(Of T) (value As Object, ByRef message As Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler(Of T))
Type Parameters
- T
The expected type of value.
Parameters
- value
- Object
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
- 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
IsInstanceOfType<T>(Object, Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<T>, String)
- 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 T IsInstanceOfType<T>(object? value, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler<T> message, string valueExpression = "");
static member IsInstanceOfType : obj * AssertGenericIsInstanceOfTypeInterpolatedStringHandler * string -> 'T
Public Shared Function IsInstanceOfType(Of T) (value As Object, ByRef message As Assert.AssertGenericIsInstanceOfTypeInterpolatedStringHandler(Of T), Optional valueExpression As String = "") As T
Type Parameters
- T
The expected type of value.
Parameters
- value
- Object
- valueExpression
- String