Share via


TestContext.AspNetDevelopmentServerPrefix フィールド

ASP.NET 開発サーバーのプレフィックスを表します。

名前空間:  Microsoft.VisualStudio.TestTools.UnitTesting
アセンブリ:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 内)

構文

'宣言
Public Const AspNetDevelopmentServerPrefix As String
public const string AspNetDevelopmentServerPrefix
public:
literal String^ AspNetDevelopmentServerPrefix
static val mutable AspNetDevelopmentServerPrefix: string
public const var AspNetDevelopmentServerPrefix : 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"];
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

TestContext クラス

Microsoft.VisualStudio.TestTools.UnitTesting 名前空間

その他の技術情報

Using the TestContext Class