Ejemplo n.º 1
0
    public async Task RunIndividualTestCase(H2SpecTestCase testCase)
    {
        var hostBuilder = new HostBuilder()
                          .ConfigureWebHost(webHostBuilder =>
        {
            webHostBuilder
            .UseKestrel(options =>
            {
                options.Listen(IPAddress.Loopback, 0, listenOptions =>
                {
                    listenOptions.Protocols = HttpProtocols.Http2;
                    if (testCase.Https)
                    {
                        listenOptions.UseHttps(TestResources.GetTestCertificate());
                    }
                });
            })
            .Configure(ConfigureHelloWorld);
        })
                          .ConfigureServices(AddTestLogging);

        using (var host = hostBuilder.Build())
        {
            await host.StartAsync();

            await H2SpecCommands.RunTest(testCase.Id, host.GetPort(), testCase.Https, Logger);

            await host.StopAsync();
        }
    }
Ejemplo n.º 2
0
        public async Task RunIndividualTestCase(H2SpecTestCase testCase)
        {
            var memoryPoolFactory = new DiagnosticMemoryPoolFactory(allowLateReturn: true);

            var hostBuilder = TransportSelector.GetWebHostBuilder(memoryPoolFactory.Create)
                              .UseKestrel(options =>
            {
                options.Listen(IPAddress.Loopback, 0, listenOptions =>
                {
                    listenOptions.Protocols = HttpProtocols.Http2;
                    if (testCase.Https)
                    {
                        listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
                    }
                });
            })
                              .ConfigureServices(AddTestLogging)
                              .Configure(ConfigureHelloWorld);

            using (var host = hostBuilder.Build())
            {
                await host.StartAsync();

                H2SpecCommands.RunTest(testCase.Id, host.GetPort(), testCase.Https, Logger);
            }
        }