public void GetDays_CorrectDays(
            DateTime month, 
            int firstDayOfMonthIndex, 
            int lastDayOfMonthIndex)
        {
            var zoho = new Mock<IZohoClient>();
            var auth = new Mock<IAuthenticationStorage>();
            var job = new Mock<IJobService>();
            var target = new DaysService(zoho.Object,  auth.Object, job.Object);

            var days = target.GetDays(month);

            for (int i = 0; i < DaysService.TotalDaysInATable; i++)
            {
                if (i >= firstDayOfMonthIndex && i <= lastDayOfMonthIndex)
                {
                    Assert.True(days[i].IsActive, string.Format("Day is not active. {0}", month));
                    var dayOfWeekActual = i%5;
                    var dayOfWeekExpected = (int)new DateTime(month.Year, month.Month, days[i].Day).DayOfWeek - 1;
                    Assert.Equal(dayOfWeekExpected, dayOfWeekActual);
                }
                else
                {
                    Assert.False(days[i].IsActive, string.Format("Day is active. {0}", month));
                }
            }
        }
        public async void FillDays_TimeLogRecieved_FilledWithCorrectValues(
            [Frozen] Mock<IZohoClient> zoho,
            [Frozen] Mock<IAuthenticationStorage> auth,
            AuthenticationData authData,
            DaysService target)
        {
            var startOfTheMonth = new DateTime(2015, 07, 01);
            var middleOfTheMonth = new DateTime(2015, 07, 15);
            var endOfTheMonth = startOfTheMonth.EndOfMonth();
            
            var firstLog = new TimeLog { WorkDate = startOfTheMonth, Hours = TimeSpan.FromHours(8) };
            var secondLog1 = new TimeLog { WorkDate = middleOfTheMonth, Hours = TimeSpan.FromHours(2) };
            var secondLog2 = new TimeLog { WorkDate = middleOfTheMonth, Hours = TimeSpan.FromHours(12) };
            var thirdLog = new TimeLog { WorkDate = endOfTheMonth, Hours = TimeSpan.FromHours(10) };

            var timeLogs = new List<TimeLog>
            {
                firstLog,
                secondLog1,
                secondLog2,
                thirdLog
            };

            auth.Setup(x => x.GetAuthenticationData())
                .Returns(authData);
            var days = target.GetDays(startOfTheMonth);

            zoho.Setup(x => x.TimeTracker.TimeLog.GetAsync(authData.Id, startOfTheMonth, endOfTheMonth, "all", "all"))
                .ReturnsAsync(timeLogs);
            
            // Act
            await target.FillDaysWithTimeLogsAsync(days, startOfTheMonth);

            // Assert
            zoho.Verify(x => x.TimeTracker.TimeLog.GetAsync(authData.Id, startOfTheMonth, endOfTheMonth, "all", "all"));
            zoho.Verify(x => x.Leave.GetHolidaysAsync(authData.Id));
            
            var firstDayInCalendar = days.First(x => x.Day == startOfTheMonth.Day);
            Assert.True(firstDayInCalendar.IsActive);
            Assert.True(firstDayInCalendar.IsFilled);
            Assert.Equal(TimeSpan.FromHours(8), firstDayInCalendar.Hours);
            Assert.False(firstDayInCalendar.IsHoliday);
            
            var secondDayInCalendar = days.First(x => x.Day == middleOfTheMonth.Day);
            Assert.True(secondDayInCalendar.IsActive);
            Assert.True(secondDayInCalendar.IsFilled);
            Assert.Equal(TimeSpan.FromHours(14), secondDayInCalendar.Hours);
            Assert.False(secondDayInCalendar.IsHoliday);
            
            var secondMiddleDayInCalendar = days.First(x => x.Day == middleOfTheMonth.Day + 1);
            Assert.False(secondMiddleDayInCalendar.IsHoliday);
            
            var thirdDayInMonth = days.First(x => x.Day == endOfTheMonth.Day);
            Assert.True(thirdDayInMonth.IsActive);
            Assert.True(thirdDayInMonth.IsFilled);
            Assert.Equal(TimeSpan.FromHours(10), thirdDayInMonth.Hours);
            Assert.False(thirdDayInMonth.IsHoliday);
            Assert.Null(thirdDayInMonth.HolidayName);

            var notFilledDay = days.First(x => x.Day == 2);
            Assert.True(notFilledDay.IsActive);
            Assert.False(notFilledDay.IsFilled);
        }
        public async void FillDays_HolidaysRecieved_FilledWithCorrectValues(
            [Frozen] Mock<IZohoClient> zoho,
            [Frozen] Mock<IAuthenticationStorage> auth,
            AuthenticationData authData,
            DaysService target)
        {
            var startOfTheMonth = new DateTime(2015, 07, 01);
            var middleOfTheMonth = new DateTime(2015, 07, 15);
            var endOfTheMonth = startOfTheMonth.EndOfMonth();

            var singleDayyOffHoliday = new Holiday
            {
                FromDate = startOfTheMonth,
                ToDate = startOfTheMonth,
                Name = "singleHoliday",
                Remarks = DaysService.DayOffHolidayRemark
            };

            var singleDayNotOffHoliday = new Holiday
            {
                FromDate = endOfTheMonth,
                ToDate = endOfTheMonth,
                Name = "singleNoDayOffHoliday",
                Remarks = "Could be given off."
            };

            var coupleDaysHoliday = new Holiday
            {
                FromDate = middleOfTheMonth,
                ToDate = middleOfTheMonth.AddDays(1),
                Name = "twoDays",
                Remarks = DaysService.DayOffHolidayRemark
            };

            var holidays = new List<Holiday>
            {
                singleDayyOffHoliday,
                singleDayNotOffHoliday,
                coupleDaysHoliday
            };

            
            auth.Setup(x => x.GetAuthenticationData())
                .Returns(authData);
            var days = target.GetDays(startOfTheMonth);

            zoho.Setup(x => x.Leave.GetHolidaysAsync(It.IsAny<string>())).ReturnsAsync(holidays);

            // Act
            await target.FillDaysWithTimeLogsAsync(days, startOfTheMonth);

            // Assert
            zoho.Verify(x => x.Leave.GetHolidaysAsync(authData.Id));

            var firstDayInCalendar = days.First(x => x.Day == startOfTheMonth.Day);
            Assert.True(firstDayInCalendar.IsHoliday);
            Assert.Equal(singleDayyOffHoliday.Name, firstDayInCalendar.HolidayName);

            var secondDayInCalendar = days.First(x => x.Day == middleOfTheMonth.Day);
            Assert.True(secondDayInCalendar.IsHoliday);
            Assert.Equal(coupleDaysHoliday.Name, secondDayInCalendar.HolidayName);

            var secondMiddleDayInCalendar = days.First(x => x.Day == middleOfTheMonth.Day + 1);
            Assert.True(secondMiddleDayInCalendar.IsHoliday);
            Assert.Equal(coupleDaysHoliday.Name, secondMiddleDayInCalendar.HolidayName);

            var thirdDayInMonth = days.First(x => x.Day == endOfTheMonth.Day);
            Assert.False(thirdDayInMonth.IsHoliday);
            Assert.Null(thirdDayInMonth.HolidayName);
        }