public void UpdateForecast_OutputsCorrectString() { DisplayForecast forecastObserver = new DisplayForecast(weatherSubject, testOutput); weatherSubject.NotifyObservers(1, 2, 3); weatherSubject.NotifyObservers(2, 3, 4); string expectedForecast = "Getting warmer " + "and muggier, " + "showers expected later."; string actual = (string)testOutput.Items[0]; Assert.AreEqual(expectedForecast, actual, "Forecast observer updates and prints correctly"); }
public static void Main() { int track = 0; WeatherStation weatherStation = new WeatherStation(); DisplayForecast displayForecast = new DisplayForecast(); DisplayStatistics displayStatistics = new DisplayStatistics(); weatherStation.Register(displayStatistics); weatherStation.Register(displayForecast); do { weatherStation.SetData(new Random().Next(100), new Random().Next(100)); track++; Thread.Sleep(5000); } while (track < 5); }