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(); }
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); }
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); }
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); }