public ReadonlyEndpointTests(ITestOutputHelper output,
                              ConfiguringWebApplicationFactory <TStartup> factory)
 {
     Output       = output;
     HttpClient   = TestHttpClientFactory.CreateReadonlyClient(factory);
     InstanceName = "readonly";
 }
 public WriteableEndpointTests(ITestOutputHelper output,
         ConfiguringWebApplicationFactory<TStartup> factory) {
     Output = output;
     HttpClient = TestHttpClientFactory.CreateWriteableClient(factory);
     InstanceName = HttpClient.GetInstanceName();
     this.factory = factory;
 }
Ejemplo n.º 3
0
        public static HttpClient CreateReadonlyClient <TStartup>(
            ConfiguringWebApplicationFactory <TStartup> factory)
            where TStartup : class
        {
            var httpClient = factory.CreateClient();

            httpClient.DefaultRequestHeaders.Add(Interceptor.HDR_USE_READONLY, "");
            return(httpClient);
        }
Ejemplo n.º 4
0
        public static HttpClient CreateWriteableClient <TStartup>(
            ConfiguringWebApplicationFactory <TStartup> factory)
            where TStartup : class
        {
            var instanceName = Guid.NewGuid().ToString();
            var httpClient   = factory.CreateClient();

            httpClient.DefaultRequestHeaders.Add(Interceptor.HDR_USE_INMEMORY, instanceName);
            return(httpClient);
        }
Ejemplo n.º 5
0
        public static HttpClient CreateReadonlyClient <TStartup>(
            ConfiguringWebApplicationFactory <TStartup> factory,
            string[] commandLineOptions)
            where TStartup : class
        {
            var httpClient = factory
                             .WithWebHostBuilder(builder => {
                builder.ConfigureAppConfiguration(options => {
                    options.AddCommandLine(commandLineOptions);
                });
            })
                             .CreateClient();

            httpClient.DefaultRequestHeaders.Add(Interceptor.HDR_USE_READONLY, "");
            return(httpClient);
        }
Ejemplo n.º 6
0
        public static HttpClient CreateWriteableClient <TStartup>(
            ConfiguringWebApplicationFactory <TStartup> factory,
            string[] commandLineOptions)
            where TStartup : class
        {
            var instanceName = Guid.NewGuid().ToString();
            var httpClient   = factory
                               .WithWebHostBuilder(builder => {
                builder.ConfigureAppConfiguration(options => {
                    options.AddCommandLine(commandLineOptions);
                });
            })
                               .CreateClient();

            httpClient.DefaultRequestHeaders.Add(Interceptor.HDR_USE_INMEMORY, instanceName);
            return(httpClient);
        }