public void WorkingDaysCalculator_PeriodWithTwoHolidaysAndWithAWeekend_CountsAllTheDaysMinusTheWeekendAndTheHolidays_Test()
        {
            const int expected           = 4;
            const int officeId           = 1;
            var       startDate          = new DateTime(2013, 6, 17); //monday
            var       endDateDate        = new DateTime(2013, 6, 23); //sunday
            var       calendarRepository = new Data.Repositories.Fakes.StubICalendarRepository();

            calendarRepository.GetOfficeCalendarInt32 = i => new Calendar
            {
                CalendarHolidays = new Collection <CalendarHolidays>
                {
                    new CalendarHolidays {
                        Day = new DateTime(2013, 6, 17)
                    },
                    new CalendarHolidays {
                        Day = new DateTime(2013, 6, 23)
                    }
                }
            };
            var workingDaysCalculator = new WorkingDaysCalculator(calendarRepository);

            int result = workingDaysCalculator.GetWorkingDays(officeId, startDate, endDateDate);

            Assert.AreEqual(expected, result);
        }
        void CreateVacationRequests(MyCompanyContext context)
        {
            var workingDaysCalculator = new WorkingDaysCalculator(new CalendarRepository(context));

            var now   = DateTime.UtcNow.Date;
            int total = 0;

            foreach (var employee in context.Employees)
            {
                int requests = 2;
                for (int i = 0; i < requests; i++)
                {
                    int days = _randomize.Next(2, 4);
                    var from = now.AddDays(10 + 5 * i);
                    var to   = now.AddDays(14 + 5 * i);

                    int numDays = workingDaysCalculator.GetWorkingDays(employee.OfficeId, from, to);
                    var request = new VacationRequest()
                    {
                        From             = from,
                        To               = to,
                        NumDays          = numDays,
                        Comments         = GetComment(total),
                        CreationDate     = DateTime.UtcNow.AddDays(-1),
                        LastModifiedDate = DateTime.UtcNow,
                        Status           = (VacationRequestStatus)i + 1,
                        EmployeeId       = employee.EmployeeId,
                    };
                    total++;
                    context.VacationRequests.Add(request);
                }
            }

            context.SaveChanges();
        }
        public void WorkingDaysCalculator_PeriodWithoutHolidaysOrWeekends_CountsAllTheDays_Test()
        {
            const int expected           = 5;
            const int officeId           = 1;
            var       startDate          = new DateTime(2013, 6, 17); //monday
            var       endDateDate        = new DateTime(2013, 6, 21); //friday
            var       calendarRepository = new Data.Repositories.Fakes.StubICalendarRepository();

            calendarRepository.GetOfficeCalendarInt32 = i => new Calendar
            {
                CalendarHolidays = new Collection <CalendarHolidays>()
            };
            var workingDaysCalculator = new WorkingDaysCalculator(calendarRepository);

            int result = workingDaysCalculator.GetWorkingDays(officeId, startDate, endDateDate);

            Assert.AreEqual(expected, result);
        }