public void Given_employee_When_amend_Then_should_set_properties_correctly() { //Given var employee = new Employee { ContactDetails = new List<EmployeeContactDetail> { new EmployeeContactDetail() } }; var amendParameters = new AddUpdateEmployeeParameters() { EmployeeReference = "Test" }; var contactDetails = new AddUpdateEmployeeContactDetailsParameters() { Address1 = "Address1", Address2 = "Address2", Address3 = "Address3" }; //When employee.Update(amendParameters, contactDetails, _user); //Then Assert.That(employee.EmployeeReference, Is.EqualTo(amendParameters.EmployeeReference)); Assert.That(employee.LastModifiedOn.Value.Date, Is.EqualTo(DateTime.Today)); Assert.That(employee.ContactDetails.Count, Is.EqualTo(1)); Assert.That(employee.ContactDetails.First().Address1, Is.EqualTo(contactDetails.Address1)); Assert.That(employee.ContactDetails.First().Address2, Is.EqualTo(contactDetails.Address2)); Assert.That(employee.ContactDetails.First().Address3, Is.EqualTo(contactDetails.Address3)); }
private AddUpdateEmployeeParameters CreateEmployeeParameters(SaveEmployeeRequest request) { var result = new AddUpdateEmployeeParameters() { EmployeeReference = request.EmployeeReference, Title = request.Title, Forename = request.Forename, Surname = request.Surname, MiddleName = request.MiddleName, PreviousSurname = request.PreviousSurname, Sex = request.Sex, HasDisability = request.HasDisability, DisabilityDescription = request.DisabilityDescription, SiteId = request.SiteId, JobTitle = request.JobTitle, NINumber = request.NINumber, PassportNumber = request.PassportNumber, PPSNumber = request.PPSNumber, WorkVisaNumber = request.WorkVisaNumber, DrivingLicenseNumber = request.DrivingLicenseNumber, HasCompanyVehicle = request.HasCompanyVehicle, CompanyVehicleRegistration = request.CompanyVehicleRegistration, ClientId = request.CompanyId, NotificationType = MapNotificationType(request.NotificationType), NotificationFrequency = request.NotificiationFrequency }; if (request.DateOfBirth.HasValue && request.DateOfBirth.Value != DateTime.MinValue) { result.DateOfBirth = request.DateOfBirth.Value; } if (request.WorkVisaExpirationDate.HasValue && request.WorkVisaExpirationDate.Value != DateTime.MinValue) { result.WorkVisaExpirationDate = request.WorkVisaExpirationDate.Value; } if (request.DrivingLicenseExpirationDate.HasValue && request.DrivingLicenseExpirationDate.Value != DateTime.MinValue) { result.DrivingLicenseExpirationDate = request.DrivingLicenseExpirationDate.Value; } if (request.NationalityId.HasValue) { result.Nationality = _nationalityRepository.LoadById(request.NationalityId.Value); } if (request.CompanyVehicleTypeId.HasValue && request.CompanyVehicleTypeId.Value > 0) { result.CompanyVehicleType = _companyVehicleTypeRepository.LoadById(request.CompanyVehicleTypeId.Value); } if (request.EmploymentStatusId.HasValue) { result.EmploymentStatus = _employmentStatusRepository.LoadById(request.EmploymentStatusId.Value); } if (request.SiteId.HasValue) { result.Site = _siteRepository.GetById(request.SiteId.Value); } return result; }
public void Setup() { _creatingUser = new UserForAuditing() { Id = Guid.NewGuid() }; _addUpdateEmployeeParameters = new AddUpdateEmployeeParameters() { ClientId = 1234L, CompanyVehicleRegistration = "reg", CompanyVehicleType = new CompanyVehicleType(), DateOfBirth = DateTime.Now, DisabilityDescription = "legless", DrivingLicenseExpirationDate = DateTime.Now, DrivingLicenseNumber = "licence", EmployeeReference = "reference", EmploymentStatus = new EmploymentStatus(), Forename = "first", HasCompanyVehicle = true, HasDisability = true, JobTitle = "job", MiddleName = "middle", NINumber = "ni number", Nationality = new Nationality(), OrganisationalUnitId = 1234L, PPSNumber = "pps", PassportNumber = "passport", PreviousSurname = "previous", Sex = "sex", Site = new Site(), SiteId = 1234L, Surname = "surname", Title = "title", WorkVisaExpirationDate = DateTime.Now, WorkVisaNumber = "visa#" }; }