Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            weatherMeasurements = new WeatherMeasurements();

            currentObserver = new CurrentObserver(weatherMeasurements);
            averageObserver = new AveragesObserver(weatherMeasurements);
            forcastObserver = new ForecastObserver(weatherMeasurements);
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            weatherMeasurements = new WeatherMeasurements();

            currentObserver = new CurrentObserver(weatherMeasurements);
            averageObserver = new AveragesObserver(weatherMeasurements);
            forcastObserver = new ForecastObserver(weatherMeasurements);
        }
Ejemplo n.º 3
0
        public void AverageTemperatureDisplay()
        {
            WeatherMeasurements subject = new WeatherMeasurements();
            AveragesObserver observer = new AveragesObserver(subject);

            subject.Measurements.UpdateMeasurements(5, 5, 5);
            subject.NotifyObservers();
            subject.Measurements.UpdateMeasurements(7, 7, 7);
            subject.NotifyObservers();

            String expected = "Temperature:\t6,Humidity:\t\t6,Pressure:\t\t6";
            String actual = observer.Display();

            Assert.AreEqual(expected, actual);
        }