private string GetTrainingCode(ApiTypes.TrainingType trainingType, string code) { var result = code; if (trainingType == ApiTypes.TrainingType.Framework) { result = code.Split('-')[0]; } return(result); }
public void AndMappingTrainingType(int?standardId, string frameworkCode, ApiTypes.TrainingType expectedTrainingType) { var expectedTrainingCode = standardId.HasValue ? standardId.ToString() : frameworkCode; var domainType = new ApprenticeshipSummary() { FrameworkLarsCode = frameworkCode, StandardLarsCode = standardId }; var result = _mapper.Map <ApiTypes.ApprenticeshipSummary>(domainType); result.TrainingType.Should().Be(expectedTrainingType); result.TrainingCode.Should().Be(expectedTrainingCode); }
private async Task <string> GetTrainingTitle(ApiTypes.TrainingType trainingType, string trainingCode) { var code = int.Parse(trainingCode); if (trainingType == ApiTypes.TrainingType.Framework) { var framework = await _trainingDetailService.GetFrameworkDetailsAsync(code); return(framework.Title); } else { var standard = await _trainingDetailService.GetStandardDetailsAsync(code); return(standard.Title); } }
public void ThenMapTrainingType(string trainingType, ApiTypes.TrainingType expectedOuput) { TrainingDetailServiceMock .Setup(t => t.GetFrameworkDetailsAsync(It.IsAny <int>())) .ReturnsAsync(FixtureInstance.Create <Framework>()); TrainingDetailServiceMock .Setup(t => t.GetStandardDetailsAsync(It.IsAny <int>())) .ReturnsAsync(FixtureInstance.Create <Standard>()); var sut = GetRecruitApprecticeshipMapper(); LiveVacancy.ProgrammeType = trainingType; var mappedVacancy = sut.MapFromRecruitVacancy(LiveVacancy).Result; mappedVacancy.TrainingType.Should().Be(expectedOuput); }