示例#1
0
        public void TestConcurrentDays_MoreThanThree()
        {
            var timeEntryStorage = new TimeEntryStorage(context);
            var absenseService   = new AbsenseDaysService(timeEntryStorage, options);

            timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto
            {
                Date   = DateTime.Now.AddDays(-9),
                Value  = 5,
                TaskId = options.CurrentValue.SickDaysTask
            }, 1);
            timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto
            {
                Date   = DateTime.Now.AddDays(-10),
                Value  = 5,
                TaskId = options.CurrentValue.SickDaysTask
            }, 1);
            timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto
            {
                Date   = DateTime.Now.AddDays(-11),
                Value  = 5,
                TaskId = options.CurrentValue.SickDaysTask
            }, 1);
            timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto
            {
                Date   = DateTime.Now.AddDays(-12),
                Value  = 5,
                TaskId = options.CurrentValue.SickDaysTask
            }, 1);

            var days = absenseService.GetAbsenseDays(1, 2021, null);

            // We withdraw three whole days
            Assert.Equal(6, days.UsedAbsenseDays);
        }
示例#2
0
        public void CheckRemainingHolidays_NoWithDrawls()
        {
            var absenseService = new AbsenseDaysService(new TimeEntryStorage(context), options);
            var days           = absenseService.GetAbsenseDays(1, 2020, null);

            Assert.Equal(0, days.UsedAbsenseDays);
        }
示例#3
0
        public void CheckRemainingHolidays_SickdaysTaken()
        {
            var timeEntryStorage = new TimeEntryStorage(context);
            var absenseService   = new AbsenseDaysService(timeEntryStorage, options);

            // One day of sick leave
            timeEntryStorage.CreateTimeEntry(new CreateTimeEntryDto
            {
                Date   = DateTime.Now.AddDays(-2),
                Value  = 5,
                TaskId = options.CurrentValue.SickDaysTask
            }, 1);


            var days = absenseService.GetAbsenseDays(1, 2021, null);

            Assert.Equal(3, days.UsedAbsenseDays);


            // These two withdrawals of sick days should also count as 3 as they are concurrent
        }