Assert.IsNotInstanceOfType Method

Definition

Overloads

IsNotInstanceOfType(Object, Type)

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

IsNotInstanceOfType(Object, Type, Assert+AssertIsNotInstanceOfTypeInterpolatedStringHandler)

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

IsNotInstanceOfType(Object, Type, String)

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

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

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

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

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

IsNotInstanceOfType<T>(Object, String)

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

IsNotInstanceOfType<T>(Object)

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

IsNotInstanceOfType<T>(Object, Assert.AssertGenericIsNotInstanceOfTypeInterpolatedStringHandler<T>)

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

IsNotInstanceOfType(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

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

public static void IsNotInstanceOfType(object value, Type wrongType);
public static void IsNotInstanceOfType(object? value, Type? wrongType);

Parameters

value
Object

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

wrongType
Type

The type that value should not be.

Exceptions

Thrown if value is not null and wrongType is in the inheritance hierarchy of value.

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType(Object, Type, Assert+AssertIsNotInstanceOfTypeInterpolatedStringHandler)

Source:
Assert.IsInstanceOfType.cs

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

public static void IsNotInstanceOfType(object? value, Type? wrongType, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsNotInstanceOfTypeInterpolatedStringHandler message);

Parameters

value
Object

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

wrongType
Type

The type that value should not be.

message
Assert.AssertIsNotInstanceOfTypeInterpolatedStringHandler

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

Applies to

MSTest.TestFramework 3.8.0
Product Versions
MSTest.TestFramework 3.8.0

IsNotInstanceOfType(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

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

public static void IsNotInstanceOfType(object value, Type wrongType, string message);
public static void IsNotInstanceOfType(object? value, Type? wrongType, string? message);

Parameters

value
Object

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

wrongType
Type

The type that value should not be.

message
String

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

Exceptions

Thrown if value is not null and wrongType is in the inheritance hierarchy of value.

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType(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

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

public static void IsNotInstanceOfType(object value, Type wrongType, string message, params object[] parameters);
public static void IsNotInstanceOfType(object? value, Type? wrongType, string? message, params object?[]? parameters);

Parameters

value
Object

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

wrongType
Type

The type that value should not be.

message
String

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

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if value is not null and wrongType is in the inheritance hierarchy of value.

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType<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

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

public static void IsNotInstanceOfType<T>(object? value, string? message, params object?[]? parameters);

Type Parameters

T

The type that value should not be.

Parameters

value
Object
message
String
parameters
Object[]

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType<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

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

public static void IsNotInstanceOfType<T>(object? value, string? message);

Type Parameters

T

The type that value should not be.

Parameters

value
Object
message
String

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType<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

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

public static void IsNotInstanceOfType<T>(object? value);

Type Parameters

T

The type that value should not be.

Parameters

value
Object

Applies to

MSTest.TestFramework 3.8.0 and other versions
Product Versions
MSTest.TestFramework 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

IsNotInstanceOfType<T>(Object, Assert.AssertGenericIsNotInstanceOfTypeInterpolatedStringHandler<T>)

Source:
Assert.IsInstanceOfType.cs

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

public static void IsNotInstanceOfType<T>(object? value, Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsNotInstanceOfTypeInterpolatedStringHandler<T> message);

Type Parameters

T

The type that value should not be.

Parameters

value
Object

Applies to

MSTest.TestFramework 3.8.0
Product Versions
MSTest.TestFramework 3.8.0