Exemple #1
0
        public void LeaveDetailsShouldIncludeOtherLeaveTypes()
        {
            var personWithStaff = _servicesFixture.InsertPerson(person => person.IsThai = true);
            var job             = _servicesFixture.InsertJob();
            var expectedDays    = 5;
            var leaveRequest    = _servicesFixture.InsertLeaveRequest(LeaveType.Other, personWithStaff.Id, expectedDays);

            var currentLeaveDetails = _leaveService.GetCurrentLeaveDetails(personWithStaff.Id);
            var leaveUseage         = currentLeaveDetails.LeaveUseages.SingleOrDefault(useage => useage.LeaveType == LeaveType.Other);

            Assert.NotNull(leaveUseage);
            Assert.Equal(expectedDays, leaveUseage.Used);
        }
Exemple #2
0
        public void NotifiesHrWhenAppropriate(LeaveRequest request, PersonWithStaff personWithStaff, int usedLeave,
                                              int totalYears, bool expectedEmailed)
        {
            var job = _servicesFixture.InsertJob(j =>
            {
                //force job to provide time off
                j.Type          = JobType.FullTime;
                j.OrgGroup.Type = GroupType.Department;
            });

            _dbConnection.Insert(personWithStaff);
            _dbConnection.Insert(personWithStaff.Staff);
            //create roles for # of years
            _servicesFixture.InsertRole(job.Id, personWithStaff.Id, totalYears);
            //insert used leave
            _servicesFixture.InsertLeaveRequest(request.Type, personWithStaff.Id, usedLeave);
            var actualEmailed = _leaveService.ShouldNotifyHr(request,
                                                             _leaveService.GetCurrentLeaveUseage(request.Type, personWithStaff.Id));

            Assert.Equal(expectedEmailed, actualEmailed);
        }