TestDocumentLoaders Class
Creates the loaders that connect the pages to an application in memory, to an HTTP handler, or to folders.
public static class TestDocumentLoadersMethods
| Name | Description |
|---|---|
| FromDirectories(Uri, IEnumerable<KeyValuePair<string, string>>) | Creates a loader that serves the files of folders for the URLs of an origin, by URL path prefix: { "/" : "wwwroot" } serves https://localhost/css/app.css from wwwroot/css/app.css. The other URLs are network errors. |
| FromHttpMessageHandler(HttpMessageHandler) | Creates a loader that sends the requests of the pages to an HTTP message handler. The handler must not follow the redirects nor handle the cookies: the pages do it, as in a browser. |
| FromTestServer(TestServer) | Creates a loader that sends the requests of the pages to an in-memory ASP.NET Core application (TestServer, for instance WebApplicationFactory.Server). The cookies and the redirects are handled by the pages, as in a browser. |
FromDirectories(Uri, IEnumerable<KeyValuePair<string, string>>)
TestDocumentLoaders.csCreates a loader that serves the files of folders for the URLs of an origin, by URL path prefix: { "/" : "wwwroot" } serves https://localhost/css/app.css from wwwroot/css/app.css. The other URLs are network errors.
public static DocumentLoader FromDirectories(Uri origin, IEnumerable<KeyValuePair<string, string>> folders)Parameters
originUri- The origin of the URLs (
https://localhost/). foldersIEnumerable<KeyValuePair<string, string>>- The folders, by URL path prefix.
Returns
DocumentLoader The loader.
FromHttpMessageHandler(HttpMessageHandler)
TestDocumentLoaders.csCreates a loader that sends the requests of the pages to an HTTP message handler. The handler must not follow the redirects nor handle the cookies: the pages do it, as in a browser.
public static DocumentLoader FromHttpMessageHandler(HttpMessageHandler handler)FromTestServer(TestServer)
TestDocumentLoaders.csCreates a loader that sends the requests of the pages to an in-memory ASP.NET Core application (TestServer, for instance WebApplicationFactory.Server). The cookies and the redirects are handled by the pages, as in a browser.
public static DocumentLoader FromTestServer(TestServer server)