Share via


TestServer Classe

Definizione

Implementazione IServer per l'esecuzione di test.

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
Ereditarietà
TestServer
Implementazioni

Costruttori

TestServer(IServiceProvider)

Per l'uso con IHostBuilder.

TestServer(IServiceProvider, IFeatureCollection)

Per l'uso con IHostBuilder.

TestServer(IServiceProvider, IFeatureCollection, IOptions<TestServerOptions>)

Per l'uso con IHostBuilder.

TestServer(IServiceProvider, IOptions<TestServerOptions>)

Per l'uso con IHostBuilder.

TestServer(IWebHostBuilder)

Per l'uso con IWebHostBuilder.

TestServer(IWebHostBuilder, IFeatureCollection)

Per l'uso con IWebHostBuilder.

Proprietà

AllowSynchronousIO

Ottiene o imposta un valore che controlla se l'I Request /O sincrono è consentito per e Response. Il valore predefinito è false.

BaseAddress

Ottiene o imposta l'indirizzo di base associato a HttpClient restituito dal server di test. Il valore predefinito è http://localhost/.

Features

Ottiene la raccolta di funzionalità del server associate al server di test.

Host

Ottiene l'istanza IWebHost associata al server di test.

PreserveExecutionContext

Ottiene o imposta un valore che controlla se ExecutionContext e AsyncLocal<T> i valori vengono mantenuti dal client al server. Il valore predefinito è false.

Services

Ottiene il provider di servizi associato al server di test.

Metodi

CreateClient()

Crea un HttpClient oggetto per l'elaborazione di richieste/risposte HTTP con il server di test.

CreateHandler()

Crea un oggetto personalizzato HttpMessageHandler per l'elaborazione di richieste/risposte HTTP con il server di test.

CreateHandler(Action<HttpContext>)

Crea un oggetto personalizzato HttpMessageHandler per l'elaborazione di richieste/risposte HTTP con la configurazione personalizzata con il server di test.

CreateRequest(String)

Inizia a creare un messaggio di richiesta per l'invio.

CreateWebSocketClient()

Crea un WebSocketClient oggetto per interagire con il server di test.

Dispose()

Eliminare l'oggetto IWebHost associato al server di test.

SendAsync(Action<HttpContext>, CancellationToken)

Crea, configura, invia e restituisce un oggetto HttpContext. Questa operazione viene completata non appena viene avviata la risposta.

Implementazioni dell'interfaccia esplicita

IServer.Features

Implementazione IServer per l'esecuzione di test.

IServer.Start<TContext>(IHttpApplication<TContext>)

Implementazione IServer per l'esecuzione di test.

IServer.StartAsync<TContext>(IHttpApplication<TContext>, CancellationToken)

Implementazione IServer per l'esecuzione di test.

IServer.StopAsync(CancellationToken)

Implementazione IServer per l'esecuzione di test.

Si applica a