public async Task GetWeatherForecast_ReturnsLocationWeather_WhenSuccess() { server.Given(Request.Create() .UsingGet() .WithPath("/api/location/1")) .RespondWith(Response.Create() .WithBody(@"{ ""woeid"": 1, ""title"": ""Location"", ""latt_long"": ""1,2"", ""location_type"": ""City"", ""consolidated_weather"": [ { ""min_temp"": 1, ""max_temp"": 2, ""applicable_date"": ""2020-06-20"" }, { ""min_temp"": 3, ""max_temp"": 4, ""applicable_date"": ""2020-06-21"" } ] }") .WithSuccess()); var result = await service.GetWeatherForecast(1); result.Should().BeEquivalentTo(new LocationWeatherDto { Woeid = 1, Title = "Location", LattLong = "1,2", LocationType = "City", ConsolidatedWeather = new List <ForecastDto> { new ForecastDto { MinTemp = 1, MaxTemp = 2, ApplicableDate = new DateTime(2020, 06, 20) }, new ForecastDto { MinTemp = 3, MaxTemp = 4, ApplicableDate = new DateTime(2020, 06, 21) } } }); }
public async Task MetaWeatherService_RetrieveForecastForValidLocation_ForecastRetrieved() { var forecasts = await _weatherService.GetWeatherForecast("belfast"); Assert.True(forecasts.ToList().Count > 0); }