public void Setup() { Initialize(); var sut = GetRecruitApprecticeshipMapper(); _mappedVacancy = sut.MapFromRecruitVacancy(LiveVacancy).Result; }
public ApiTypes.ApprenticeshipVacancy MapToApprenticeshipVacancy(ApprenticeshipVacancy apprenticeshipVacancy) { var liveVacancyBaseUrl = _provideSettings.GetSetting(ApplicationSettingKeys.LiveApprenticeshipVacancyBaseUrlKey); var apprenticeship = new ApiTypes.ApprenticeshipVacancy { VacancyReference = apprenticeshipVacancy.VacancyReferenceNumber, Title = apprenticeshipVacancy.Title, ShortDescription = apprenticeshipVacancy.ShortDescription, Description = apprenticeshipVacancy.Description, WageUnit = MapWageUnit(apprenticeshipVacancy.WageUnitId), WorkingWeek = apprenticeshipVacancy.WorkingWeek, WageText = MapWage(apprenticeshipVacancy), WageAdditionalInformation = null, HoursPerWeek = apprenticeshipVacancy.HoursPerWeek, ExpectedDuration = apprenticeshipVacancy.ExpectedDuration, ExpectedStartDate = apprenticeshipVacancy.ExpectedStartDate, PostedDate = apprenticeshipVacancy.PostedDate, ApplicationClosingDate = apprenticeshipVacancy.ApplicationClosingDate, NumberOfPositions = apprenticeshipVacancy.NumberOfPositions, EmployerName = apprenticeshipVacancy.IsAnonymousEmployer ? apprenticeshipVacancy.AnonymousEmployerName : apprenticeshipVacancy.EmployerName, EmployerDescription = apprenticeshipVacancy.IsAnonymousEmployer ? apprenticeshipVacancy.AnonymousEmployerDescription : apprenticeshipVacancy.EmployerDescription, EmployerWebsite = apprenticeshipVacancy.IsAnonymousEmployer ? null : apprenticeshipVacancy.EmployerWebsite, TrainingToBeProvided = apprenticeshipVacancy.TrainingToBeProvided, QualificationsRequired = apprenticeshipVacancy.QualificationsRequired, SkillsRequired = apprenticeshipVacancy.SkillsRequired, PersonalQualities = apprenticeshipVacancy.PersonalQualities, FutureProspects = apprenticeshipVacancy.FutureProspects, ThingsToConsider = apprenticeshipVacancy.ThingsToConsider, IsNationwide = apprenticeshipVacancy.VacancyLocationTypeId == Nationwide, SupplementaryQuestion1 = apprenticeshipVacancy.SupplementaryQuestion1, SupplementaryQuestion2 = apprenticeshipVacancy.SupplementaryQuestion2, VacancyUrl = $"{liveVacancyBaseUrl}/{apprenticeshipVacancy.VacancyReferenceNumber}", Location = _geoCodedAddressMapper.MapToLocation(apprenticeshipVacancy.Location, showAnonymousEmployerDetails: apprenticeshipVacancy.IsAnonymousEmployer), ContactName = apprenticeshipVacancy.ContactName, ContactEmail = apprenticeshipVacancy.ContactEmail, ContactNumber = apprenticeshipVacancy.ContactNumber, TrainingProviderName = apprenticeshipVacancy.TrainingProvider, TrainingProviderUkprn = apprenticeshipVacancy.TrainingProviderUkprn, TrainingProviderSite = apprenticeshipVacancy.TrainingProviderSite, //This is mapped to provider's trading name IsEmployerDisabilityConfident = apprenticeshipVacancy.IsDisabilityConfident, ApprenticeshipLevel = EducationLevelHelper.RemapFromInt(apprenticeshipVacancy.ApprenticeshipTypeId).ToString(), ApplicationUrl = apprenticeshipVacancy.EmployersRecruitmentWebsite, ApplicationInstructions = apprenticeshipVacancy.EmployersApplicationInstructions }; MapTrainingDetails(apprenticeshipVacancy, apprenticeship); return(apprenticeship); }
private void MapTrainingDetails(ApprenticeshipVacancy src, ApiTypes.ApprenticeshipVacancy dest) { if (src.Framework != null) { dest.TrainingType = ApiTypes.TrainingType.Framework; dest.TrainingTitle = src.Framework.Title; dest.TrainingCode = src.Framework.Code.ToString(); } else if (src.Standard != null) { dest.TrainingType = ApiTypes.TrainingType.Standard; dest.TrainingTitle = src.Standard.Title; dest.TrainingCode = src.Standard.Code.ToString(); } else { dest.TrainingType = ApiTypes.TrainingType.Unavailable; } }
public async Task <ApiTypes.ApprenticeshipVacancy> MapFromRecruitVacancy(recruitEntities.Vacancy liveVacancy) { var liveVacancyBaseUrl = _provideSettings.GetSetting(ApplicationSettingKeys.LiveApprenticeshipVacancyBaseUrlKey); var trainingType = (ApiTypes.TrainingType)Enum.Parse(typeof(ApiTypes.TrainingType), liveVacancy.ProgrammeType); var trainingCode = GetTrainingCode(trainingType, liveVacancy.ProgrammeId); var trainingTitle = await GetTrainingTitle(trainingType, trainingCode); var qualifications = GetVacancyQualification(liveVacancy); var skills = string.Join(",", liveVacancy.Skills); var wageText = GetWageText(liveVacancy.Wage, liveVacancy.StartDate); var duration = GetDurationAsText(liveVacancy.Wage); var wageUnit = GetWageUnit(liveVacancy.Wage.WageType); var apprenticeship = new ApiTypes.ApprenticeshipVacancy { VacancyReference = liveVacancy.VacancyReference, Title = liveVacancy.Title, ShortDescription = liveVacancy.ShortDescription, Description = liveVacancy.Description, WageUnit = wageUnit, WorkingWeek = liveVacancy.Wage.WorkingWeekDescription, WageText = wageText, WageAdditionalInformation = liveVacancy.Wage.WageAdditionalInformation, HoursPerWeek = liveVacancy.Wage.WeeklyHours, ExpectedDuration = duration, ExpectedStartDate = liveVacancy.StartDate, PostedDate = liveVacancy.LiveDate, ApplicationClosingDate = liveVacancy.ClosingDate, NumberOfPositions = liveVacancy.NumberOfPositions, EmployerName = liveVacancy.EmployerName, EmployerDescription = liveVacancy.EmployerDescription, EmployerWebsite = liveVacancy.IsAnonymous ? null : liveVacancy.EmployerWebsiteUrl, ContactName = liveVacancy.EmployerContactName ?? liveVacancy.ProviderContactName, ContactEmail = liveVacancy.EmployerContactEmail ?? liveVacancy.ProviderContactEmail, ContactNumber = liveVacancy.EmployerContactPhone ?? liveVacancy.ProviderContactPhone, TrainingToBeProvided = liveVacancy.TrainingDescription, QualificationsRequired = qualifications, SkillsRequired = skills, PersonalQualities = null, ApplicationInstructions = liveVacancy.ApplicationInstructions, ApplicationUrl = liveVacancy.ApplicationUrl, FutureProspects = liveVacancy.OutcomeDescription, ThingsToConsider = liveVacancy.ThingsToConsider, IsNationwide = false, SupplementaryQuestion1 = null, SupplementaryQuestion2 = null, VacancyUrl = $"{liveVacancyBaseUrl}/{liveVacancy.VacancyReference}", Location = MapFromRecruitAddress(liveVacancy.EmployerLocation, liveVacancy.IsAnonymous), TrainingProviderName = liveVacancy.TrainingProvider.Name, TrainingProviderUkprn = liveVacancy.TrainingProvider.Ukprn.ToString(), TrainingProviderSite = null, IsEmployerDisabilityConfident = false, ApprenticeshipLevel = liveVacancy.ProgrammeLevel, TrainingType = trainingType, TrainingCode = trainingCode, TrainingTitle = trainingTitle }; return(apprenticeship); }