コード例 #1
0
        public async Task <HttpClient> GetTestClient()
        {
            var host = await new HostBuilder()
                       .ConfigureWebHost(webBuilder =>
            {
                webBuilder
                .UseTestServer()
                .ConfigureServices(services =>
                {
                    services
                    .AddMvcCore()
                    .AddControllersAsServices();

                    if (_useResponseCompression)
                    {
                        services.AddResponseCompression();
                    }
                })
                .Configure(app =>
                {
                    if (_useResponseCompression)
                    {
                        ResponseCompressionBuilderExtensions.UseResponseCompression(app);
                    }

                    if (_options == null)
                    {
                        ApplicationBuilderExtensions.UseBodilessResponses(app);
                    }
                    else
                    {
                        ApplicationBuilderExtensions.UseBodilessResponses(app, _options);
                    }

                    EndpointRoutingApplicationBuilderExtensions.UseRouting(app);
                    EndpointRoutingApplicationBuilderExtensions.UseEndpoints(app, endpoints =>
                    {
                        ControllerEndpointRouteBuilderExtensions.MapControllers(endpoints);
                    });
                });
            })
                       .StartAsync();

            var httpClient = host.GetTestClient();

            if (_header != null)
            {
                httpClient.DefaultRequestHeaders.Add(_header, _value);
            }

            return(httpClient);
        }
コード例 #2
0
 private void ConfigureTenantPipeline(IApplicationBuilder appBuilder)
 {
     V_0             = new ModularTenantRouterMiddleware.u003cu003ec__DisplayClass7_0();
     V_0.appBuilder  = appBuilder;
     V_0.startups    = ServiceProviderServiceExtensions.GetServices <IStartup>(V_0.appBuilder.get_ApplicationServices());
     stackVariable8  = V_0;
     stackVariable10 = V_0.startups;
     stackVariable11 = ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9__7_0;
     if (stackVariable11 == null)
     {
         dummyVar0       = stackVariable11;
         stackVariable11 = new Func <IStartup, int>(ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9.u003cConfigureTenantPipelineu003eb__7_0);
         ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9__7_0 = stackVariable11;
     }
     stackVariable8.startups = stackVariable10.OrderBy <IStartup, int>(stackVariable11);
     dummyVar1 = EndpointRoutingApplicationBuilderExtensions.UseEndpoints(EndpointRoutingApplicationBuilderExtensions.UseRouting(V_0.appBuilder), new Action <IEndpointRouteBuilder>(V_0.u003cConfigureTenantPipelineu003eb__1));
     return;
 }