public void weather_data_updates_heatindex_correctly() { var wd = new WeatherData(); var heatdisplay = new HeatIndexDisplay(wd); wd.SetMeasurements(80, 65, 30.4f); Assert.AreEqual("Heat index is 82.95535", heatdisplay.Display()); wd.SetMeasurements(78, 90, 29.2f); Assert.AreEqual("Heat index is 83.64967", heatdisplay.Display()); }
public void weather_data_updates_observers_correctly() { var wd = new WeatherData(); var conditions = new CurrentConditionsDisplay(wd); var heat = new HeatIndexDisplay(wd); var stats = new StatisticsDisplay(wd); var forecast = new ForecastDisplay(wd); wd.SetMeasurements(80, 65, 30.4f); Assert.AreEqual("Current Conditions: 80 celsius and humidity 65", conditions.Display()); Assert.AreEqual("Heat index is 82.95535", heat.Display()); Assert.AreEqual("Avg/Max/Min Temperature: 80/80/80", stats.Display()); Assert.AreEqual("Improving weather on the way!", forecast.Display()); wd.SetMeasurements(78, 90, 29.2f); Assert.AreEqual("Current Conditions: 78 celsius and humidity 90", conditions.Display()); Assert.AreEqual("Heat index is 83.64967", heat.Display()); Assert.AreEqual("Avg/Max/Min Temperature: 79/80/78", stats.Display()); Assert.AreEqual("Weather is getting bad!", forecast.Display()); }