public void Test_3VacationDaysOnAlvDays_3VacationDaysUsed() { var timeEntryStorage = new TimeEntryStorage(context); var absenseService = new AbsenseDaysService(timeEntryStorage, options); timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto { Date = new DateTime(2021, 3, 29), Value = 7.5M, TaskId = options.CurrentValue.PaidHolidayTask }, 1); timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto { Date = new DateTime(2021, 3, 30), Value = 7.5M, TaskId = options.CurrentValue.PaidHolidayTask }, 1); timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto { Date = new DateTime(2021, 3, 31), Value = 7.5M, TaskId = options.CurrentValue.PaidHolidayTask }, 1); var holidayOverview = absenseService.GetVacationDays(1, 2021, 6, 1); Assert.Equal(3, holidayOverview.UsedVacationDays); Assert.Equal(25, holidayOverview.AvailableVacationDays); }
public void Test_PlannedVacationDayOnAlvDay_PlannedDaysNotDoubled() { var timeEntryStorage = new TimeEntryStorage(context); var absenseService = new AbsenseDaysService(timeEntryStorage, options); for (int i = 0; i < 5; i++) { timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto { Date = new DateTime(2021, 12, 27).AddDays(i), Value = 7.5M, TaskId = options.CurrentValue.PaidHolidayTask }, 1); } var holidayOverview = absenseService.GetVacationDays(1, 2021, 6, 1); Assert.Equal(3, holidayOverview.UsedVacationDays); Assert.Equal(5, holidayOverview.PlannedVacationDays); Assert.Equal(25, holidayOverview.AvailableVacationDays); }
public void Test_Complicated_HolidayCalculations() { var timeEntryStorage = new TimeEntryStorage(context); var absenseService = new AbsenseDaysService(timeEntryStorage, options); // Create both planned and used holiday for (int i = 0; i < 10; i++) { timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto { Date = new DateTime(2020, 6, 5).AddDays(i * -1), Value = 5, TaskId = options.CurrentValue.PaidHolidayTask }, 1); } var holidayOverview = absenseService.GetVacationDays(1, 2020, 6, 1); Assert.Equal(9, holidayOverview.UsedVacationDays); Assert.Equal(8, holidayOverview.PlannedVacationDays); Assert.Equal(15, holidayOverview.AvailableVacationDays); }