public IntegrationTests(WebApplicationFactory <Startup> factory1, CustomWebApplicationFactory <Startup> factory2) { _geoApi1 = RestService.For <IGeoApi>(factory1.CreateClient()); _cache1 = factory1.Server.Host.Services.GetRequiredService <IDistributedCache>(); _geoApi2 = RestService.For <IGeoApi>(factory2.CreateClient()); _cache2 = factory2.Server.Host.Services.GetRequiredService <IDistributedCache>(); _options2 = factory2.Server.Host.Services.GetRequiredService <IOptions <CassetteOptions> >().Value; }
public void Refit_works(IGeoApi geoApi) { // Act var regions = geoApi.GetRegionsAsync().Result; // Assert regions.Should().NotBeEmpty(); regions.First().Code.Should().NotBeNullOrEmpty(); regions.First().Nom.Should().NotBeNullOrEmpty(); }
public void Refit_with_multi_header_values_works(IGeoApi geoApi) { // Act var response = geoApi.GetRegionsHttpResponseAsync().Result; // Assert response.RequestMessage.Headers.UserAgent.ToString().Should().Be("myagent"); response.RequestMessage.Headers.GetValues("key1").First().ToString().Should().Be("value1"); response.RequestMessage.Headers.GetValues("api-key").First().ToString().Should().Be("xxxxx"); }
public HomeController(IRestClient <IGeoApi> geoApiClient) { _geoApi = geoApiClient.Client; }
public GeoController(IGeoApi geoApi) { _geoApi = geoApi; }