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)处理,按升序排序,并按优先级应用,直到找到匹配项。

适用于