WebApplicationFactoryContentRootAttribute Class

Definition

Metadata that WebApplicationFactory<TEntryPoint> uses to find out the content root for the web application represented by TEntryPoint. WebApplicationFactory<TEntryPoint> will iterate over all the instances of WebApplicationFactoryContentRootAttribute, filter the instances whose Key is equal to TEntryPointFullName, order them by Priority in ascending order. WebApplicationFactory<TEntryPoint> will check for the existence of the marker in Path.Combine(ContentRootPath, Path.GetFileName(ContentRootTest))" and if the file exists it will set the content root to 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
Inheritance
WebApplicationFactoryContentRootAttribute
Attributes

Constructors

WebApplicationFactoryContentRootAttribute(String, String, String, String)

Initializes a new instance of WebApplicationFactoryContentRootAttribute.

Properties

ContentRootPath

Gets the content root path for a given project. This content root can be relative or absolute. If it is a relative path, it will be combined with BaseDirectory.

ContentRootTest

A marker file used to ensure that the path the content root is being set to is correct.

Key

Gets the key for the content root associated with this project. Typically FullName.

Priority

Gets a number for determining the probing order when multiple WebApplicationFactoryContentRootAttribute instances with the same key are present on the test Assembly.

Applies to