WebApplicationFactoryContentRootAttribute 建構函式

定義

初始化 WebApplicationFactoryContentRootAttribute 的新執行個體。

public:
 WebApplicationFactoryContentRootAttribute(System::String ^ key, System::String ^ contentRootPath, System::String ^ contentRootTest, System::String ^ priority);
public WebApplicationFactoryContentRootAttribute (string key, string contentRootPath, string contentRootTest, string priority);
new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryContentRootAttribute : string * string * string * string -> Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryContentRootAttribute
Public Sub New (key As String, contentRootPath As String, contentRootTest As String, priority As String)

參數

key
String

這個 WebApplicationFactoryContentRootAttribute 的索引鍵。 這個索引鍵是 WebApplicationFactory<TEntryPoint> 用來判斷測試元件上應該使用哪些 WebApplicationFactoryContentRootAttribute 實例來比對指定的 TEntryPoint 類別。

contentRootPath
String

內容根目錄的路徑。 此路徑可以是相對或絕對路徑。 如果路徑是相對的,路徑將會與 結合 GetCurrentDirectory()

contentRootTest
String

將做為標記的檔案,用來判斷指定內容的內容根路徑是否正確。

priority
String

相較于其他屬性,此內容根屬性的優先順序。 針對相同的索引鍵套用多個 WebApplicationFactoryContentRootAttribute 實例時,會以 Parse(String) 遞增連續處理這些實例,並依優先順序套用,直到找到相符專案為止。

適用於