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, Assert+AssertIsNotInstanceOfTypeInterpolatedStringHandler, 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(Object, Type, String, 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<T>(Object, Assert.AssertGenericIsNotInstanceOfTypeInterpolatedStringHandler<T>, 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, String, 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, 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, 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<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(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 not an instance of the wrong type and throws an exception if the specified type is in the inheritance hierarchy of the object.

C#
public static void IsNotInstanceOfType(object value, Type wrongType);
C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.0

IsNotInstanceOfType(Object, Type, Assert+AssertIsNotInstanceOfTypeInterpolatedStringHandler)

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.

C#
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.11.0 和其他版本
产品 版本
MSTest.TestFramework 3.8.3, 3.9.3, 3.10.5, 3.11.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
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.

C#
public static void IsNotInstanceOfType(object value, Type wrongType, string message);
C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.0

IsNotInstanceOfType(Object, Type, Assert+AssertIsNotInstanceOfTypeInterpolatedStringHandler, String)

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.

C#
public static void IsNotInstanceOfType(object? value, Type? wrongType, ref Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertIsNotInstanceOfTypeInterpolatedStringHandler message, string valueExpression = "");

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.

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

MSTest.TestFramework 4.0.0
产品 版本
MSTest.TestFramework 4.0.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
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.

C#
public static void IsNotInstanceOfType(object value, Type wrongType, string message, params object[] parameters);
C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.0

IsNotInstanceOfType(Object, Type, String, String)

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.

C#
public static void IsNotInstanceOfType(object? value, Type? wrongType, string? message = "", string valueExpression = "");

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.

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 not null and wrongType is in the inheritance hierarchy of value.

Applies to

MSTest.TestFramework 4.0.0
产品 版本
MSTest.TestFramework 4.0.0

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

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.

C#
public static void IsNotInstanceOfType<T>(object? value, Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AssertGenericIsNotInstanceOfTypeInterpolatedStringHandler<T> message, string valueExpression = "");

Type Parameters

T

The type that value should not be.

Parameters

value
Object
valueExpression
String

Applies to

MSTest.TestFramework 4.0.0
产品 版本
MSTest.TestFramework 4.0.0

IsNotInstanceOfType<T>(Object, String, String)

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.

C#
public static void IsNotInstanceOfType<T>(object? value, string? message = "", string valueExpression = "");

Type Parameters

T

The type that value should not be.

Parameters

value
Object
message
String
valueExpression
String

Applies to

MSTest.TestFramework 4.0.0
产品 版本
MSTest.TestFramework 4.0.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
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.

C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.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
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.

C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.0

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

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.

C#
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.11.0 和其他版本
产品 版本
MSTest.TestFramework 3.8.3, 3.9.3, 3.10.5, 3.11.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
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.

C#
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.11.0 和其他版本
产品 版本
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.3, 3.9.3, 3.10.5, 3.11.0