public VacancySummaryMapperTests() { var vacancySummaryFixture = new Fixture(); _vacancySummaryProjection = vacancySummaryFixture .Build <VacancySummaryProjection>() .With(vsp => vsp.EmployerAccountId, ValidEmployerAccountId) .Create(); var config = new RecruitConfiguration { FindAnApprenticeshipDetailPrefixUrl = "http://localhost:50218/apprenticeship/", EmployerRecruitAnApprenticeManageVacancyFormattedUrl = "https://employer-recruit/accounts/{0}/vacancies/{1}/manage/", ProviderRecruitAnApprenticeManageVacancyFormattedUrl = "https://provider-recruit/{0}/vacancies/{1}/manage/" }; _sut = new VacancySummaryMapper(Options.Create(config)); }
public VacancySummary MapFromVacancySummaryProjection(VacancySummaryProjection vsp, bool isForProviderOwnedVacancies) { var raaManageVacancyFormattedUrl = isForProviderOwnedVacancies ? _recruitConfig.ProviderRecruitAnApprenticeManageVacancyFormattedUrl : _recruitConfig.EmployerRecruitAnApprenticeManageVacancyFormattedUrl; var shouldAssignApplicationStats = vsp.ApplicationMethod == ApplicationMethod.ThroughFindAnApprenticeship && (vsp.Status == VacancyStatus.Live || vsp.Status == VacancyStatus.Closed); return(new VacancySummary { EmployerAccountId = vsp.EmployerAccountId, Title = vsp.Title, VacancyReference = vsp.VacancyReference, LegalEntityId = vsp.LegalEntityId, LegalEntityName = vsp.LegalEntityName, EmployerName = vsp.EmployerName, Ukprn = vsp.Ukprn, CreatedDate = vsp.CreatedDate, Status = vsp.Status.ToString(), ClosingDate = vsp.ClosingDate, ClosedDate = vsp.ClosedDate, Duration = vsp.Duration, DurationUnit = vsp.DurationUnit.ToString(), ApplicationMethod = vsp.ApplicationMethod?.ToString(), ProgrammeId = vsp.ProgrammeId, StartDate = vsp.StartDate, TrainingTitle = vsp.TrainingTitle, TrainingType = vsp.TrainingType.ToString(), TrainingLevel = vsp.TrainingLevel.ToString(), NoOfNewApplications = shouldAssignApplicationStats ? vsp.NoOfNewApplications : default(int?), NoOfSuccessfulApplications = shouldAssignApplicationStats ? vsp.NoOfSuccessfulApplications : default(int?), NoOfUnsuccessfulApplications = shouldAssignApplicationStats ? vsp.NoOfUnsuccessfulApplications : default(int?), FaaVacancyDetailUrl = vsp.VacancyReference.HasValue ? $"{_recruitConfig.FindAnApprenticeshipDetailPrefixUrl}{vsp.VacancyReference}" : null, RaaManageVacancyUrl = isForProviderOwnedVacancies ? string.Format(raaManageVacancyFormattedUrl, vsp.Ukprn, vsp.Id) : string.Format(raaManageVacancyFormattedUrl, vsp.EmployerAccountId, vsp.Id) }); }