public void ColdestDayTest() { Dictionary <DateTime, float> temperatureData = PrepareTemperatureData(10f, 30f); Tuple <DateTime, float> coldestDay = WeatherStatisticsCalculator.ColdestDay(temperatureData); Assert.AreEqual(10f, coldestDay.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}"); }