TestServer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An IServer implementation for executing tests.
public ref class TestServer : IDisposable, Microsoft::AspNetCore::Hosting::Server::IServer
public class TestServer : IDisposable, Microsoft.AspNetCore.Hosting.Server.IServer
type TestServer = class
interface IServer
interface IDisposable
Public Class TestServer
Implements IDisposable, IServer
- Inheritance
-
TestServer
- Implements
Constructors
TestServer(IServiceProvider, IFeatureCollection, IOptions<TestServerOptions>) |
For use with IHostBuilder. |
TestServer(IServiceProvider, IFeatureCollection) |
For use with IHostBuilder. |
TestServer(IServiceProvider, IOptions<TestServerOptions>) |
For use with IHostBuilder. |
TestServer(IServiceProvider) |
For use with IHostBuilder. |
TestServer(IWebHostBuilder, IFeatureCollection) |
For use with IWebHostBuilder. |
TestServer(IWebHostBuilder) |
For use with IWebHostBuilder. |
Properties
AllowSynchronousIO |
Gets or sets a value that controls whether synchronous IO is allowed for the Request and Response. The default value is |
BaseAddress |
Gets or sets the base address associated with the HttpClient returned by the test server. Defaults to http://localhost/. |
Features |
Gets the collection of server features associated with the test server. |
Host |
Gets the IWebHost instance associated with the test server. |
PreserveExecutionContext |
Gets or sets a value that controls if ExecutionContext and AsyncLocal<T> values are preserved from the client to the server. The default value is |
Services |
Gets the service provider associated with the test server. |
Methods
CreateClient() |
Creates a HttpClient for processing HTTP requests/responses with the test server. |
CreateHandler() |
Creates a custom HttpMessageHandler for processing HTTP requests/responses with the test server. |
CreateHandler(Action<HttpContext>) |
Creates a custom HttpMessageHandler for processing HTTP requests/responses with custom configuration with the test server. |
CreateRequest(String) |
Begins constructing a request message for submission. |
CreateWebSocketClient() |
Creates a WebSocketClient for interacting with the test server. |
Dispose() |
Dispose the IWebHost object associated with the test server. |
SendAsync(Action<HttpContext>, CancellationToken) |
Creates, configures, sends, and returns a HttpContext. This completes as soon as the response is started. |
Explicit Interface Implementations
IServer.Features | |
IServer.Start<TContext>(IHttpApplication<TContext>) | |
IServer.StartAsync<TContext>(IHttpApplication<TContext>, CancellationToken) | |
IServer.StopAsync(CancellationToken) |