3 instantiations of TestServer
Microsoft.AspNetCore.Mvc.Testing (3)
WebApplicationFactory.cs (3)
628protected virtual TestServer CreateServer(IWebHostBuilder builder) => new(builder); 642return new(serviceProvider, options); 645return new(serviceProvider);
29 references to TestServer
Microsoft.AspNetCore.Mvc.Testing (19)
WebApplicationFactory.cs (19)
37private TestServer? _server; 50/// create a <see cref="TestServer"/> instance using the MVC application defined by <typeparamref name="TEntryPoint"/> 51/// and one or more <see cref="HttpClient"/> instances used to send <see cref="HttpRequestMessage"/> to the <see cref="TestServer"/>. 84/// Gets the <see cref="TestServer"/> created by this <see cref="WebApplicationFactory{TEntryPoint}"/>. 86public TestServer Server 411_server = (TestServer)_host.Services.GetRequiredService<IServer>(); 582/// Creates a <see cref="IHostBuilder"/> used to set up <see cref="TestServer"/>. 599/// Creates a <see cref="IWebHostBuilder"/> used to set up <see cref="TestServer"/>. 620/// Creates the <see cref="TestServer"/> with the bootstrapped application in <paramref name="builder"/>. 626/// <returns>The <see cref="TestServer"/> with the bootstrapped application.</returns> 628protected virtual TestServer CreateServer(IWebHostBuilder builder) => new(builder); 631/// Creates the <see cref="TestServer"/> with the <see cref="IServiceProvider"/> from the bootstrapped application. 637protected virtual TestServer CreateServer(IServiceProvider serviceProvider) 894private readonly Func<IWebHostBuilder, TestServer> _createServer; 895private readonly Func<IServiceProvider, TestServer> _createServerFromServiceProvider; 904Func<IWebHostBuilder, TestServer> createServer, 905Func<IServiceProvider, TestServer> createServerFromServiceProvider, 925protected override TestServer CreateServer(IWebHostBuilder builder) => _createServer(builder); 927protected override TestServer CreateServer(IServiceProvider serviceProvider) => _createServerFromServiceProvider(serviceProvider);
Microsoft.AspNetCore.TestHost (10)
HostBuilderTestServerExtensions.cs (2)
21public static TestServer GetTestServer(this IHost host) 23return (TestServer)host.Services.GetRequiredService<IServer>();
RequestBuilder.cs (2)
20public RequestBuilder(TestServer server, string path) 29public TestServer TestServer { get; }
WebHostBuilderExtensions.cs (6)
23/// Enables the <see cref="TestServer" /> service. 32services.AddSingleton<IServer, TestServer>(); 37/// Enables the <see cref="TestServer" /> service. 48services.AddSingleton<IServer, TestServer>(); 58public static TestServer GetTestServer(this IWebHost host) 60return (TestServer)host.Services.GetRequiredService<IServer>();