WebApplicationFactoryContentRootAttribute 類別

定義

WebApplicationFactory<TEntryPoint>用來找出所 TEntryPoint 表示之 Web 應用程式內容根目錄的中繼資料。 WebApplicationFactory<TEntryPoint>會逐一查看 的所有 實例,以遞增順序篩選其 Key 等於 TEntryPointFullNamePriority 的實例。 WebApplicationFactoryContentRootAttribute WebApplicationFactory<TEntryPoint> 將會檢查 中 Path.Combine(ContentRootPath, Path.GetFileName(ContentRootTest))" 是否有標記存在,而且檔案是否存在,它會將內容根目錄設定為 ContentRootPath

public ref class WebApplicationFactoryContentRootAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed class WebApplicationFactoryContentRootAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)>]
type WebApplicationFactoryContentRootAttribute = class
    inherit Attribute
Public NotInheritable Class WebApplicationFactoryContentRootAttribute
Inherits Attribute
繼承
WebApplicationFactoryContentRootAttribute
屬性

建構函式

WebApplicationFactoryContentRootAttribute(String, String, String, String)

初始化 WebApplicationFactoryContentRootAttribute 的新執行個體。

屬性

ContentRootPath

取得指定專案的內容根路徑。 此內容根目錄可以是相對或絕對。 如果是相對路徑,則會與 BaseDirectory 結合。

ContentRootTest

標記檔案,用來確保內容根目錄設定的路徑正確無誤。

Key

取得與此專案相關聯之內容根目錄的索引鍵。 通常為 FullName

Priority

取得在測試 Assembly 上存在多個 WebApplicationFactoryContentRootAttribute 具有相同索引鍵的實例時,判斷探查順序的數位。

適用於