Assert.IsExactInstanceOfType 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
| Name | Description |
|---|---|
| IsExactInstanceOfType(Object, Type, String, String) |
Tests whether the specified object is exactly an instance of the expected type and throws an exception if the expected type does not match exactly. |
| IsExactInstanceOfType(Object, Type, Assert+AssertIsExactInstanceOfTypeInterpolatedStringHandler, String) |
Tests whether the specified object is exactly an instance of the expected type and throws an exception if the expected type does not match exactly. |
| IsExactInstanceOfType<T>(Object, Assert.AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler<T>, String) |
Tests whether the specified object is exactly an instance of the generic type and throws an exception if the generic type does not match exactly. |
| IsExactInstanceOfType<T>(Object, String, String) |
Tests whether the specified object is exactly an instance of the generic type and throws an exception if the generic type does not match exactly. |
IsExactInstanceOfType(Object, Type, String, String)
Tests whether the specified object is exactly an instance of the expected type and throws an exception if the expected type does not match exactly.
public static void IsExactInstanceOfType(object? value, Type? expectedType, string? message = "", string valueExpression = "");
static member IsExactInstanceOfType : obj * Type * string * string -> unit
Public Shared Sub IsExactInstanceOfType (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 exact type of value.
- message
- String
The message to include in the exception when value
is not exactly 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 exactly the type
of value.
Applies to
IsExactInstanceOfType(Object, Type, Assert+AssertIsExactInstanceOfTypeInterpolatedStringHandler, String)
Tests whether the specified object is exactly an instance of the expected type and throws an exception if the expected type does not match exactly.
public static void IsExactInstanceOfType(object? value, Type? expectedType, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsExactInstanceOfTypeInterpolatedStringHandler message, string valueExpression = "");
static member IsExactInstanceOfType : obj * Type * AssertIsExactInstanceOfTypeInterpolatedStringHandler * string -> unit
Public Shared Sub IsExactInstanceOfType (value As Object, expectedType As Type, ByRef message As Assert.AssertIsExactInstanceOfTypeInterpolatedStringHandler, Optional valueExpression As String = "")
Parameters
- value
- Object
The object the test expects to be of the specified type.
- expectedType
- Type
The expected exact type of value.
The message to include in the exception when value
is not exactly 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
IsExactInstanceOfType<T>(Object, Assert.AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler<T>, String)
Tests whether the specified object is exactly an instance of the generic type and throws an exception if the generic type does not match exactly.
public static T IsExactInstanceOfType<T>(object? value, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler<T> message, string valueExpression = "");
static member IsExactInstanceOfType : obj * AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler * string -> 'T
Public Shared Function IsExactInstanceOfType(Of T) (value As Object, ByRef message As Assert.AssertGenericIsExactInstanceOfTypeInterpolatedStringHandler(Of T), Optional valueExpression As String = "") As T
Type Parameters
- T
The expected exact type of value.
Parameters
- value
- Object
- valueExpression
- String
Returns
Applies to
IsExactInstanceOfType<T>(Object, String, String)
Tests whether the specified object is exactly an instance of the generic type and throws an exception if the generic type does not match exactly.
public static T IsExactInstanceOfType<T>(object? value, string? message = "", string valueExpression = "");
static member IsExactInstanceOfType : obj * string * string -> 'T
Public Shared Function IsExactInstanceOfType(Of T) (value As Object, Optional message As String = "", Optional valueExpression As String = "") As T
Type Parameters
- T
The expected exact type of value.
Parameters
- value
- Object
- message
- String
- valueExpression
- String