次の方法で共有


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 に転送できるため、この文字列を直接使用することはありません。

この文字列は、テストに対して AspNetDevelopmentServerAttribute を指定した結果として起動される ASP.NET 開発サーバー インスタンスの 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

トップに戻る