Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void TempObs_UpdateValues_ReturnsExpected()
        {
            //Create needed objects
            ListBox lb = new ListBox();
            WeatherSubject ws = new WeatherSubject();
            TemperatureObserver tObs = new TemperatureObserver(lb, ws);

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

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

            Assert.AreEqual(expected, actual);
        }