예제 #1
0
파일: JobTests.cs 프로젝트: fossabot/gis
        public void FetchJobListWithFilledDoesntThrow()
        {
            LinqToDB.Common.Configuration.Linq.GenerateExpressionTest = true;
            var job = _sf.InsertJob();

            _sf.InsertRole(job.Id, active: true);
            var jobs = _js.JobWithFilledInfos();

            jobs.ShouldNotBeNull();
            jobs.ShouldNotBeEmpty();
        }
예제 #2
0
        public void StaffOrgGroupIdUpdatedOnNewRoleAdded()
        {
            var job = _servicesFixture.InsertJob();

            Assert.NotEqual(Guid.Empty, job.OrgGroupId);
            var person = _servicesFixture.InsertPerson();

            Assert.NotEqual(job.OrgGroupId, person.Staff.OrgGroupId);
            var role = AutoFaker.Generate <PersonRole>();

            role.Id       = Guid.Empty;
            role.Active   = true;
            role.JobId    = job.Id;
            role.PersonId = person.Id;
            _personService.Save(role);
            Assert.Equal(job.OrgGroupId, _db.Staff.Single(s => s.Id == person.StaffId).OrgGroupId);
        }
예제 #3
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);
        }
예제 #4
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);
        }