public void GetHrAdminsReturnsUsers() { var personAdmin = _servicesFixture.InsertPerson(); var personHrStaff = _servicesFixture.InsertPerson(); var hrAdmin = _servicesFixture.InsertUser(u => u.PersonId = personAdmin.Id, "hradmin"); var nonHrAdmin = _servicesFixture.InsertUser(u => u.PersonId = personHrStaff.Id, "hr"); var actualStaff = _servicesFixture.Get <PersonRepository>().GetHrAdminStaff().Single(); Assert.Equal(personAdmin.Id, actualStaff.Id); }
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); }