public void WeatherViewModelsUpdate() { // Arrange var wm = new MockWeatherModel(); var weekVm = new WeatherThisWeekViewModel(); var dayVm = new WeatherTodayViewModel(); mockSunnyWeather(wm); wm.Update(); weekVm.Initialize(wm); dayVm.Initialize(wm); // Act mockRainyWeather(wm); wm.Update(); // Assert that viewmodels updated correctly to the "rainyWeather" values Assert.AreEqual("Rainy", weekVm.CurrentWeather.Conditions); Assert.AreEqual(20, weekVm.CurrentWeather.Rainfall); Assert.AreEqual(5, weekVm.CurrentWeather.Snowfall); Assert.AreEqual(15, weekVm.CurrentWeather.Temperature); Assert.AreEqual("Rainy", weekVm.Forecast.First().Conditions); Assert.AreEqual("Friday 27", weekVm.Forecast.First().Date); Assert.AreEqual(16, weekVm.Forecast.First().TemperatureHigh); Assert.AreEqual(14, weekVm.Forecast.First().TemperatureLow); Assert.AreEqual("Rainy", dayVm.CurrentWeather.Conditions); Assert.AreEqual(20, dayVm.CurrentWeather.Rainfall); Assert.AreEqual(5, dayVm.CurrentWeather.Snowfall); Assert.AreEqual(15, dayVm.CurrentWeather.Temperature); Assert.AreEqual("7:31", dayVm.Sunrise); Assert.AreEqual("5:29", dayVm.Sunset); Assert.AreEqual("Rainy", dayVm.Forecast.First().Conditions); Assert.AreEqual(20, dayVm.Forecast.First().Rainfall); Assert.AreEqual(5, dayVm.Forecast.First().Snowfall); Assert.AreEqual(16, dayVm.Forecast.First().Temperature); Assert.AreEqual(1, dayVm.Forecast.First().Time); // 1pm }
public void WeatherViewModelsUpdate() { // Arrange var wm = new MockWeatherModel(); var weekVm = new WeatherThisWeekViewModel(); var dayVm = new WeatherTodayViewModel(); mockSunnyWeather(wm); wm.Update(); weekVm.Initialize(wm); dayVm.Initialize(wm); // Act mockRainyWeather(wm); wm.Update(); // Assert that viewmodels updated correctly to the "rainyWeather" values Assert.AreEqual("Rainy", weekVm.CurrentWeather.Conditions); Assert.AreEqual(20, weekVm.CurrentWeather.Rainfall); Assert.AreEqual(5, weekVm.CurrentWeather.Snowfall); Assert.AreEqual(15, weekVm.CurrentWeather.Temperature); Assert.AreEqual("Rainy", weekVm.Forecast.First().Conditions); Assert.AreEqual("Friday 27", weekVm.Forecast.First().Date); Assert.AreEqual(16, weekVm.Forecast.First().TemperatureHigh); Assert.AreEqual(14, weekVm.Forecast.First().TemperatureLow); Assert.AreEqual("Rainy", dayVm.CurrentWeather.Conditions); Assert.AreEqual(20, dayVm.CurrentWeather.Rainfall); Assert.AreEqual(5, dayVm.CurrentWeather.Snowfall); Assert.AreEqual(15, dayVm.CurrentWeather.Temperature); Assert.AreEqual("7:31", dayVm.Sunrise); Assert.AreEqual("5:29", dayVm.Sunset); Assert.AreEqual("Rainy", dayVm.Forecast.First().Conditions); Assert.AreEqual(20, dayVm.Forecast.First().Rainfall); Assert.AreEqual(5, dayVm.Forecast.First().Snowfall); Assert.AreEqual(16, dayVm.Forecast.First().Temperature); Assert.AreEqual(1, dayVm.Forecast.First().Time); // 1pm }
public void WeatherCorrectlyIdentifiesOutcomingRain() { // Arrange var wm = new MockWeatherModel(); mockRainyThenSunnyWeather(wm); wm.Update(); var dayVm = new WeatherTodayViewModel(); dayVm.Initialize(wm); Assert.AreEqual("Rainy", dayVm.CurrentWeather.Conditions); Assert.AreEqual(20, dayVm.CurrentWeather.Rainfall); Assert.AreEqual(5, dayVm.CurrentWeather.Snowfall); Assert.AreEqual(15, dayVm.CurrentWeather.Temperature); Assert.AreEqual("Sunny", dayVm.Forecast.First().Conditions); Assert.AreEqual(0, dayVm.Forecast.First().Rainfall); Assert.AreEqual(0, dayVm.Forecast.First().Snowfall); Assert.AreEqual(26, dayVm.Forecast.First().Temperature); Assert.AreEqual("Rain ends at 1 pm", dayVm.RainForecast); }
public void WeatherCorrectlyIdentifiesOutcomingRain() { // Arrange var wm = new MockWeatherModel(); mockRainyThenSunnyWeather(wm); wm.Update(); var dayVm = new WeatherTodayViewModel(); dayVm.Initialize(wm); Assert.AreEqual("Rainy", dayVm.CurrentWeather.Conditions); Assert.AreEqual(20, dayVm.CurrentWeather.Rainfall); Assert.AreEqual(5, dayVm.CurrentWeather.Snowfall); Assert.AreEqual(15, dayVm.CurrentWeather.Temperature); Assert.AreEqual("Sunny", dayVm.Forecast.First().Conditions); Assert.AreEqual(0, dayVm.Forecast.First().Rainfall); Assert.AreEqual(0, dayVm.Forecast.First().Snowfall); Assert.AreEqual(26, dayVm.Forecast.First().Temperature); Assert.AreEqual("Rain ends at 1 pm", dayVm.RainForecast); }