public void Init() { expectedResponse = new Airport { location = new Location { lat = 4.763385, lon = 52.309069 } }; var content = JsonConvert.SerializeObject(expectedResponse); httpClientMock = HttpClientMockHelper.CreateMock(content); var inMemorySettings = new Dictionary <string, string> { { "airportsEndpoint", "https://localhost" }, }; IConfiguration configuration = new ConfigurationBuilder() .AddInMemoryCollection(inMemorySettings) .Build(); client = new AirportClient(httpClientMock, configuration); }
public async Task ShouldThrowNoAirportDataException() { httpClientMock = HttpClientMockHelper.CreateMock(string.Empty, HttpStatusCode.BadRequest); await Assert.ThrowsExceptionAsync <NoAirportDataException>(async() => await client.GetAirportData("WAW")); }