TestContext.AspNetDevelopmentServerPrefix 字段
表示 ASP.NET 开发服务器的前缀。
命名空间: Microsoft.VisualStudio.TestTools.UnitTesting
程序集: Microsoft.VisualStudio.QualityTools.UnitTestFramework(Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)
语法
public const string AspNetDevelopmentServerPrefix
public:
literal String^ AspNetDevelopmentServerPrefix
static val mutable AspNetDevelopmentServerPrefix : string
Public Const AspNetDevelopmentServerPrefix As String
字段值
Type: System.String
备注
此常数的值为“AspNetDevelopmentServer”。
多数情况下不会直接使用此字符串,因为可以使用 TryUrlRedirection 方法将 Web 服务调用定向到正确的 URL。
如果要获取“ASP.NET 开发服务器”实例(该实例是由于在测试中指定 AspNetDevelopmentServerAttribute 而启动的)的 URL 前缀,必须使用此字符串。将此字符串与 AspNetDevelopmentServerAttribute 中指定的名称一起使用。有关更多信息,请参见以下代码段。
示例
[TestMethod]
[AspNetDevelopmentServerAttribute("MyServer", @"c:\websites\website1", "/website1")]
public void Test()
{
Uri uriPrefix = TestContext.Properties[TestContext.AspNetDevelopmentServerPrefix + "MyServer"];
}
请参阅
TestContext 类
Microsoft.VisualStudio.TestTools.UnitTesting 命名空间
b41b6c8b-5c47-4445-a73a-1b095c626c93
返回页首