Beispiel #1
0
        public void HotestDayTest()
        {
            Dictionary <DateTime, float> temperatureData = PrepareTemperatureData(10f, 30f);
            Tuple <DateTime, float>      hotestDay       = WeatherStatisticsCalculator.HotestDay(temperatureData);

            Assert.AreEqual(30f, hotestDay.Item2);
        }
        /// Solution through 1st approach - where this will send data to WeatherStatisticsCalculator
        ///
        /// Pros - Simple
        ///
        /// Cons - Breaking changes in WeatherStatisticsCalculator will break this class as well.
        public void DoWeatherStatistics()
        {
            Tuple <DateTime, float> coldestday = WeatherStatisticsCalculator.ColdestDay(_temperatureData);

            Console.WriteLine($"Coldest day was {coldestday.Item1.ToShortDateString()} with {coldestday.Item2} temperature !!>");

            Tuple <DateTime, float> hotestday = WeatherStatisticsCalculator.HotestDay(_temperatureData);

            Console.WriteLine($"Hotestday day was {hotestday.Item1.ToShortDateString()} with {hotestday.Item2} temperature !!>");

            float avgTemperature = WeatherStatisticsCalculator.AvgTemperature(_temperatureData);

            Console.WriteLine($"Average temperature was {avgTemperature:f2}");
        }