public Form1() { InitializeComponent(); weatherSubject = new WeatherSubject(); temperatureObserver = new TemperatureObserver(listTemperature, weatherSubject); averageObserver = new AverageObserver(listAverages, weatherSubject); forecastObserver = new ForecastObserver(listForecast, weatherSubject); }
public void AverageObserver_ComputeAverageTemperatureWithTwoReadings_ReturnsAverage() { AverageObserver averageObserver = new AverageObserver(listBox, weatherSubject); averageObserver.Update(15, 50, 102); averageObserver.Update(20, 50, 102); double expected = 17.50; double actual = averageObserver.currComputedTemperature; Assert.AreEqual(expected, actual); }