Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            weatherSubject = new WeatherSubject();

            temperatureObserver = new TemperatureObserver(listTemperature, weatherSubject);
            averageObserver     = new AverageObserver(listAverages, weatherSubject);
            forecastObserver    = new ForecastObserver(listForecast, weatherSubject);
        }
Exemple #2
0
        public void ForecastObserver_PredictForecastWithOneReading_ReturnsPrediction()
        {
            ForecastObserver forecastObserver = new ForecastObserver(listBox, weatherSubject);
            forecastObserver.Update(15, 50, 102);

            string expected = "asteroids will hit the earth.";
            string actual = forecastObserver.prediction;

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public Form1()
        {
            InitializeComponent();

            weatherSubject = new WeatherSubject();

            temperatureObserver = new TemperatureObserver(listTemperature, weatherSubject);
            averageObserver = new AverageObserver(listAverages, weatherSubject);
            forecastObserver = new ForecastObserver(listForecast, weatherSubject);
        }
Exemple #4
0
        public void ForecastObserver_PredictForecastWithTwoReadings_ReturnsPrediction()
        {
            ForecastObserver forecastObserver = new ForecastObserver(listBox, weatherSubject);
            forecastObserver.Update(15, 50, 102);
            forecastObserver.Update(15, 50, 98);

            string expected = "showers likely, perhaps hail";
            string actual = forecastObserver.prediction;

            Assert.AreEqual(expected, actual);
        }