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

            //Instantiate sub+obs
            ws = new WeatherSubject();
            tObs = new TemperatureObserver(lbTemp, ws);
            aObs = new AverageObserver(lbAverages, ws);
            fObs = new ForeCastObserver(lbForecast, ws);
        }
Example #2
0
        public void AvgObs_UpdateValues_ReturnsExpected()
        {
            //Create needed objects
            ListBox lb = new ListBox();
            WeatherSubject ws = new WeatherSubject();
            AverageObserver aObs = new AverageObserver(lb, ws);

            //Update tobs with some values
            aObs.Update(23,1,1);

            double expected = 23.00;
            double actual = aObs.CCompTemp;

            Assert.AreEqual(expected, actual);
        }