public ServiceInformation(Sun sun, Weather weather) { sun.Resolve(); Sunrise = sun.Sunrise; Sunset = sun.Sunset; weather.Resolve(); Temperature = weather.Temperature; }
public override void Resolve() { base.Resolve(); Weather weather = new Weather(); JToken root = JObject.Parse(LastResponse); JToken currentWeather = root["weather"]["curren_weather"].First; Weather deserializedWeather = JsonConvert.DeserializeObject<Weather>(currentWeather.ToString()); Temperature = deserializedWeather.Temperature; }
public void WeatherAPITest() { Weather weather = new Weather(); weather.Resolve(); Assert.IsFalse(weather.ErrorDetected, string.Format(errorDownloadResponse, weather.Name)); Assert.IsTrue(weather.LastUpdatedSuccessful.HasValue); Assert.AreNotEqual<DateTime>(DateTime.MinValue, weather.LastUpdatedSuccessful.Value); Assert.IsNotNull(weather.LastResponse, string.Format(errorResponseNull, weather.Name)); Assert.IsNotNull(weather.Temperature); Assert.AreNotEqual<int>(0, weather.Temperature); }