Exemple #1
0
        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);
        }
Exemple #2
0
        public async Task ShouldThrowNoAirportDataException()
        {
            httpClientMock = HttpClientMockHelper.CreateMock(string.Empty, HttpStatusCode.BadRequest);

            await Assert.ThrowsExceptionAsync <NoAirportDataException>(async() => await client.GetAirportData("WAW"));
        }