HostTypeAttribute 建構函式 (String)

初始化 HostTypeAttribute 類別的新執行個體。 這是透過使用指定執行此單元測試所在主機之類型的引數所具現化。

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

語法

'宣告
Public Sub New ( _
    hostType As String _
)
public HostTypeAttribute(
    string hostType
)
public:
HostTypeAttribute(
    String^ hostType
)
new : 
        hostType:string -> HostTypeAttribute
public function HostTypeAttribute(
    hostType : String
)

參數

  • hostType
    型別:System.String
    此單元測試執行所在之主機的類型。

備註

Visual Studio 2005 隨附的標準主機類型是 ASP.NET。

範例

[TestMethod()]
[HostType("ASP.NET")]
[UrlToTest("https://localhost:1371/webSite12")]
[AspNetDevelopmentServerHost("d:\\MyWebSite", "/MyWebSiteRoot")]
public void ConstructorTest()
{
   object target = TestProject1.Class1Accessor.CreatePrivate();
   Assert.Inconclusive("TODO: Implement code to verify target");
}

.NET Framework 安全性

請參閱

參考

HostTypeAttribute 類別

HostTypeAttribute 多載

Microsoft.VisualStudio.TestTools.UnitTesting 命名空間