private static void SummariseMonth(WeatherDataForMonth dataForMonth, IList <RainfallReading> allReadingsForYear)
        {
            dataForMonth.AverageDailyRainfall = dataForMonth.TotalRainfall /
                                                (dataForMonth.DaysWithNoRainfall + dataForMonth.DaysWithRainfall);

            dataForMonth.MedianDailyRainfall = GetMedian(allReadingsForYear.Where(r => r.Date.Month == dataForMonth.MonthNumber));
        }
        private static void AggregateMonthData(WeatherDataForMonth dataForMonth, RainfallReading rainfallReading)
        {
            if (dataForMonth.FirstDate == null || rainfallReading.Date < dataForMonth.FirstDate)
            {
                dataForMonth.FirstDate = rainfallReading.Date;
            }

            if (dataForMonth.LastDate == null || rainfallReading.Date > dataForMonth.LastDate)
            {
                dataForMonth.LastDate = rainfallReading.Date;
            }

            if (rainfallReading.Rainfall > 0)
            {
                dataForMonth.TotalRainfall += rainfallReading.Rainfall;
                dataForMonth.DaysWithRainfall++;
            }
            else
            {
                dataForMonth.DaysWithNoRainfall++;
            }
        }
        private static void AggregateYearData(WeatherDataForYear dataForYear, BomRainfallData bomRainfallData)
        {
            var rainfallReading = new RainfallReading(bomRainfallData.GetDate(), bomRainfallData.GetRainfall());

            if (dataForYear.FirstDate == null || rainfallReading.Date < dataForYear.FirstDate)
            {
                dataForYear.FirstDate = rainfallReading.Date;
            }

            if (dataForYear.LastDate == null || rainfallReading.Date > dataForYear.LastDate)
            {
                dataForYear.LastDate = rainfallReading.Date;
            }

            if (rainfallReading.Rainfall > 0)
            {
                dataForYear.TotalRainfall += rainfallReading.Rainfall;
                dataForYear.DaysWithRainfall++;
            }
            else
            {
                dataForYear.DaysWithNoRainfall++;
            }

            dataForYear.AllReadings.Add(rainfallReading);

            var monthData = dataForYear.MonthlyAggregates.FirstOrDefault(month => month.MonthNumber == rainfallReading.Date.Month);

            if (monthData == null)
            {
                monthData = WeatherDataForMonth.FromDate(rainfallReading.Date);

                dataForYear.MonthlyAggregates.Add(monthData);
            }

            AggregateMonthData(monthData, rainfallReading);
        }
        public void FromDateSetsMonthName(string date, string expectedMonthName)
        {
            var data = WeatherDataForMonth.FromDate(DateTime.Parse(date));

            data.MonthName.Should().Be(expectedMonthName);
        }