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 命名空间