public void MapDarkSkyToWeather_returns_Weather() { DarkSkyResult result = _service.GetDarkSkyResult(MockHelpers.GetDarkSkyJson()); WeatherViewModel weather = _service.MapDarkSkyToWeather(result); Assert.Equal("yyy", weather.FeelsLike); }
/// <inheritdoc /> public async Task <WeatherViewModel> GetWeatherAsync() { DarkSkyResult result = null; HttpResponseMessage response = await client.GetAsync(_apiUri); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); result = GetDarkSkyResult(content); } // return(MapDarkSkyToWeather(result)); }
/// <inheritdoc /> public WeatherViewModel MapDarkSkyToWeather(DarkSkyResult darkSky) { var currentTime = darkSky.Currently.Time.InTimeZone(darkSky.Timezone); var weather = new WeatherViewModel { ConditionsLabel = darkSky.Currently.Icon, ConditionsDesc = darkSky.Currently.Summary, DayOrNight = darkSky.Currently.Time.DayOrNight(darkSky.Daily.Data[0].SunsetTime), CurrentDate = currentTime.ToString("ddd, MMM d"), CurrentTime = currentTime.ToString("t"), FeelsLike = "(" + Math.Round(darkSky.Currently.ApparentTemperature).ToString() + ")", Temperature = Math.Round(darkSky.Currently.Temperature).ToString() }; // return(weather); }
public void DarkSkyService_returns_DarkSkyResult() { DarkSkyResult result = _service.GetDarkSkyResult(MockHelpers.GetDarkSkyJson()); Assert.Equal("America/Chicago", result.Timezone); }
/// <inheritdoc /> public WeatherViewModel MapDarkSkyToWeather(DarkSkyResult darkSky) { throw new NotImplementedException("MockDarkSkyApiService.MapDarkSkyToWeather NOT IMPLEMENTED"); }