Share via


Assert.IsNotInstanceOfType 方法 (Object, Type, String)

验证指定的对象是否不为指定类型的实例。 如果在该对象的继承层次结构中找到了指定的类型,则断言失败。 如果断言失败,将显示一则消息。

命名空间:  Microsoft.VisualStudio.TestTools.UnitTesting
程序集:  Microsoft.VisualStudio.QualityTools.UnitTestFramework(在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

语法

声明
Public Shared Sub IsNotInstanceOfType ( _
    value As Object, _
    wrongType As Type, _
    message As String _
)
public static void IsNotInstanceOfType(
    Object value,
    Type wrongType,
    string message
)
public:
static void IsNotInstanceOfType(
    Object^ value, 
    Type^ wrongType, 
    String^ message
)
static member IsNotInstanceOfType : 
        value:Object * 
        wrongType:Type * 
        message:string -> unit 
public static function IsNotInstanceOfType(
    value : Object, 
    wrongType : Type, 
    message : String
)

参数

  • value
    类型:System.Object
    要验证的对象不属于 wrongType。
  • wrongType
    类型:System.Type
    不应当在 value 的继承层次结构中找到的类型。
  • message
    类型:System.String
    断言失败时显示的消息。在单元测试结果中可以看到此消息。

异常

异常 条件
AssertFailedException

value 不为 nullnull 引用(在 Visual Basic 中为 Nothing),而且在 value 的继承层次结构中找到了 wrongType。

.NET Framework 安全性

请参见

参考

Assert 类

IsNotInstanceOfType 重载

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间

其他资源

使用 Assert 类