共用方式為


Assert.IsNotInstanceOfType 方法 (Object, Type)

確認指定的物件不是指定之型別的執行個體。 如果此型別位於物件的繼承階層架構內,判斷提示就會失敗。

命名空間:  Microsoft.VisualStudio.TestTools.UnitTesting
組件:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

語法

'宣告
Public Shared Sub IsNotInstanceOfType ( _
    value As Object, _
    wrongType As Type _
)
public static void IsNotInstanceOfType(
    Object value,
    Type wrongType
)
public:
static void IsNotInstanceOfType(
    Object^ value, 
    Type^ wrongType
)
static member IsNotInstanceOfType : 
        value:Object * 
        wrongType:Type -> unit 
public static function IsNotInstanceOfType(
    value : Object, 
    wrongType : Type
)

參數

  • value
    型別:System.Object
    要驗證的物件不屬於 wrongType。
  • wrongType
    型別:System.Type
    不應該位於 value 之繼承階層架構中的型別。

例外狀況

例外狀況 條件
AssertFailedException

value 不是 nullNull 參照 (即 Visual Basic 中的 Nothing),而且 wrongType 在 value 的繼承階層架構內。

.NET Framework 安全性

請參閱

參考

Assert 類別

IsNotInstanceOfType 多載

Microsoft.VisualStudio.TestTools.UnitTesting 命名空間

其他資源

使用 Assert 類別