예제 #1
0
        public Form1()
        {
            InitializeComponent();

            weatherMeasurements = new WeatherMeasurements();

            currentObserver = new CurrentObserver(weatherMeasurements);
            averageObserver = new AveragesObserver(weatherMeasurements);
            forcastObserver = new ForecastObserver(weatherMeasurements);
        }
        public Form1()
        {
            InitializeComponent();

            // Inititalise them
            sub = new WeatherSubject();
            cO  = new CurrentObserver(lbCurrent, sub);
            aO  = new AverageObserver(lbAverage, sub);
            fO  = new ForecastObserver(lbForecast, sub);
        }
예제 #3
0
        public Form1()
        {
            InitializeComponent();

            weatherMeasurements = new WeatherMeasurements();

            currentObserver = new CurrentObserver(weatherMeasurements);
            averageObserver = new AveragesObserver(weatherMeasurements);
            forcastObserver = new ForecastObserver(weatherMeasurements);
        }
예제 #4
0
        public void ForcastDisplay()
        {
            WeatherMeasurements subject = new WeatherMeasurements();
            ForecastObserver observer = new ForecastObserver(subject);

            subject.Measurements.UpdateMeasurements(30, 85, 992);
            subject.NotifyObservers();

            String expected = "Warm temperatures, high humidity, low pressure.";
            String actual = observer.Display();

            subject.NotifyObservers();

            Assert.AreEqual(expected, actual);
        }