共用方式為


TestAttribute 類別

定義

將這個屬性新增至類別內 的方法,讓方法可從 NUnit 測試執行器呼叫。 有一個名為 Description 的屬性,這是選擇性屬性,您可以提供更詳細的測試描述。 此類別無法獲得繼承。

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class TestAttribute : NUnit.Framework.NUnitAttribute, NUnit.Framework.Internal.IApplyToTest
type TestAttribute = class
    inherit NUnitAttribute
    interface IApplyToTest
繼承
TestAttribute
屬性
實作

範例

[TestFixture] public class Device { [Test] public void MethodToTest () {} [Test (Description = 「more detailed description」) ] publc void TestDescriptionMethod () {} }

建構函式

TestAttribute()

將這個屬性新增至類別內 的方法,讓方法可從 NUnit 測試執行器呼叫。 有一個名為 Description 的屬性,這是選擇性屬性,您可以提供更詳細的測試描述。 此類別無法獲得繼承。

屬性

Description

此測試的描述性文字

方法

ApplyToTest(Test)

將這個屬性新增至類別內 的方法,讓方法可從 NUnit 測試執行器呼叫。 有一個名為 Description 的屬性,這是選擇性屬性,您可以提供更詳細的測試描述。 此類別無法獲得繼承。

適用於