static void Main(string[] args)
        {
            var weatherData     = new WeatherData();
            var forecastDisplay = new ForecastDisplay(weatherData);
            var statDisplay     = new StatisticDisplay(weatherData);


            weatherData.Humidity    = 46.67;
            weatherData.Pressure    = 20.23;
            weatherData.Temperature = 15.54;

            var displays = new List <IDisplay>();

            displays.Add(forecastDisplay);
            displays.Add(statDisplay);

            weatherData.Humidity    = 50.67;
            weatherData.Pressure    = 67.23;
            weatherData.Temperature = 34.54;

            foreach (var display in displays)
            {
                display.Display();
            }
        }
Example #2
0
        public static void Start()
        {
            var weatherData      = new WeatherData();
            var currentDisplay   = new CurrentConditionalDisplay(weatherData);
            var statisticDisplay = new StatisticDisplay(weatherData);

            weatherData.SetMeasurements(80, 65, 30.4f);
            weatherData.SetMeasurements(82, 70, 29.2f);
            weatherData.SetMeasurements(78, 90, 29.2f);
        }
        public void WeatherDataAndStatisticDisplayTest()
        {
            Init();
            var weatherData      = new WeatherData();
            var statisticDisplay = new StatisticDisplay(weatherData);

            _verifyResult = null;
            weatherData.SetMeasurements(10, 10, 10);
            Assert.IsFalse(String.IsNullOrEmpty(_verifyResult));
            Assert.AreEqual(_verifyResult, String.Format("Average pressure: {0}", 10));
        }
Example #4
0
        static void Main(string[] args)
        {
            WeatherData             weatherData    = new WeatherData();
            CurrentConditionDisplay currentDisplay = new CurrentConditionDisplay(weatherData);
            StatisticDisplay        statsDisplay   = new StatisticDisplay(weatherData);

            weatherData.SetMeasurements(80, 65, 4f);
            weatherData.SetMeasurements(82, 70, 29.2f);
            weatherData.SetMeasurements(78, 90, 29.2f);

            Console.ReadLine();
        }
        /// <summary>
        /// Knopf für Statistik
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _btnStatistic_Click(object sender, RoutedEventArgs e)
        {
            StatisticDisplay statisticDisplay = new StatisticDisplay();

            statisticDisplay.Show();
        }