public void ShouldGetEmployerByEdsUrn() { // Act. var employer = _employerReadRepository.GetByEdsUrn(SeedData.Employers.AcmeCorp.EdsUrn); // Assert. employer.Should().NotBeNull(); }
public Employer Get(string edsUrn) { _logService.Debug("Calling Employer Repository to get employer with ERN='{0}'.", edsUrn); var employer = _employerReadRepository.GetByEdsUrn(edsUrn); if (employer == null) { _logService.Info("No record of employer with ERN='{0}' found in Employer Repository. Calling Organisation Service to get employer", edsUrn); var organisationSummary = _organisationService.GetVerifiedOrganisationSummary(edsUrn); //We don't know about this employer yet so get the reference from the organisation service and store for future use employer = _mapper.Map <VerifiedOrganisationSummary, Employer>(organisationSummary); PatchCountyAndTown(employer, organisationSummary.Address); employer = _employerWriteRepository.Save(employer); } return(employer); }