public override void Given() { cacheResult = new AddLearnerRecordViewModel { LearnerRecord = null }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheResult); }
public override void Given() { LearnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", DateofBirth = DateTime.UtcNow.AddYears(-30), ProviderName = "Barnsley College (123456789)", IsLearnerRegistered = true, IsLearnerRecordAdded = false, HasLrsEnglishAndMaths = true }; EnterUlnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; EnglishAndMathsLrsQuestionViewModel = new EnglishAndMathsLrsQuestionViewModel { EnglishAndMathsLrsStatus = EnglishAndMathsLrsStatus.AchievedWithSend }; AddLearnerRecordViewModel = new AddLearnerRecordViewModel { LearnerRecord = LearnerRecord, Uln = EnterUlnViewModel, EnglishAndMathsLrsQuestion = EnglishAndMathsLrsQuestionViewModel }; AddLearnerRecordResponse = new AddLearnerRecordResponse { IsSuccess = false }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(AddLearnerRecordViewModel); TrainingProviderLoader.AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel).Returns(AddLearnerRecordResponse); }
public override void Given() { _routeAttributes = new Dictionary <string, string> { { Constants.IsChangeMode, "true" } }; _learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", DateofBirth = DateTime.UtcNow.AddYears(-30), ProviderName = "Barnsley College (123456789)", PathwayName = "Digital Services (1234786)", IsLearnerRegistered = true, IsLearnerRecordAdded = false, HasLrsEnglishAndMaths = false }; _ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; _englishAndMathsViewModel = new EnglishAndMathsQuestionViewModel { LearnerName = _learnerRecord.Name, EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved }; IndustryPlacementQuestionViewModel = new IndustryPlacementQuestionViewModel { LearnerName = _learnerRecord.Name, IndustryPlacementStatus = IndustryPlacementStatus.NotCompleted }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord, Uln = _ulnViewModel, EnglishAndMathsQuestion = _englishAndMathsViewModel, IndustryPlacementQuestion = IndustryPlacementQuestionViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { EnglishAndMathsQuestionViewModel = new EnglishAndMathsQuestionViewModel { EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved, IsChangeMode = true }; _learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true, IsLearnerRecordAdded = false }; _ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; _industryPlacementQuestionViewModel = new IndustryPlacementQuestionViewModel { LearnerName = _learnerRecord.Name, IndustryPlacementStatus = IndustryPlacementStatus.Completed }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord, Uln = _ulnViewModel, EnglishAndMathsQuestion = EnglishAndMathsQuestionViewModel, IndustryPlacementQuestion = _industryPlacementQuestionViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { CreateMapper(); ProviderUkprn = 987654321; AddLearnerRecordViewModel = new AddLearnerRecordViewModel { LearnerRecord = new Models.Contracts.TrainingProvider.FindLearnerRecord { Uln = 1234567890, Name = "Test Name", HasLrsEnglishAndMaths = true }, Uln = new EnterUlnViewModel { EnterUln = "1234567890" }, EnglishAndMathsLrsQuestion = new EnglishAndMathsLrsQuestionViewModel { EnglishAndMathsLrsStatus = EnglishAndMathsLrsStatus.AchievedWithSend }, }; _expectedApiResult = new AddLearnerRecordResponse { Uln = AddLearnerRecordViewModel.LearnerRecord.Uln, Name = AddLearnerRecordViewModel.LearnerRecord.Name, IsSuccess = true }; InternalApiClient.AddLearnerRecordAsync(Arg.Is <AddLearnerRecordRequest>( x => x.Uln == AddLearnerRecordViewModel.LearnerRecord.Uln && x.Ukprn == ProviderUkprn && x.EnglishAndMathsLrsStatus == AddLearnerRecordViewModel.EnglishAndMathsLrsQuestion.EnglishAndMathsLrsStatus && x.PerformedBy == $"{Givenname} {Surname}" && x.PerformedUserEmail == Email)) .Returns(_expectedApiResult); Loader = new TrainingProviderLoader(InternalApiClient, Mapper); }
public override void Given() { mockCache = new AddLearnerRecordViewModel { Uln = new EnterUlnViewModel { EnterUln = uln.ToString() } }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey) .Returns(mockCache); }
public override void Given() { _ulnViewModel = new EnterUlnViewModel { EnterUln = "9895641231" }; var cacheModel = new AddLearnerRecordViewModel { Uln = _ulnViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheModel); }
public override void Given() { _learnerRecord = new FindLearnerRecord { IsLearnerRegistered = true, HasLrsEnglishAndMaths = true, IsSendConfirmationRequired = false }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord, Uln = new EnterUlnViewModel() }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { IsNavigatedFromSearchLearnerRecordNotAdded = true; _ulnViewModel = new EnterUlnViewModel { EnterUln = "9895641231" }; var cacheModel = new AddLearnerRecordViewModel { Uln = _ulnViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheModel); }
public override void Given() { EnterUlnViewModel = new EnterUlnViewModel { EnterUln = uln.ToString() }; TrainingProviderLoader.FindLearnerRecordAsync(ProviderUkprn, uln, _evaluteSendConfirmation).Returns(mockResult); mockCacheViewModel = new AddLearnerRecordViewModel { LearnerRecord = mockResult }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(mockCacheViewModel); }
public override void Given() { cacheResult = new AddLearnerRecordViewModel { LearnerRecord = new FindLearnerRecord { IsLearnerRegistered = false }, Uln = new EnterUlnViewModel(), }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheResult); }
public override void Given() { ProfileId = 1; mockCache = new AddLearnerRecordViewModel { LearnerRecord = new FindLearnerRecord { Name = "Test user" }, Uln = new EnterUlnViewModel { EnterUln = uln.ToString() } }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey) .Returns(mockCache); }
public override void Given() { _learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { _ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; _cacheResult = new AddLearnerRecordViewModel { Uln = _ulnViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { _learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true, HasLrsEnglishAndMaths = true, IsSendConfirmationRequired = false }; EnterUlnViewModel = new EnterUlnViewModel { EnterUln = _uln.ToString() }; var cacheModel = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord, Uln = EnterUlnViewModel }; TrainingProviderLoader.FindLearnerRecordAsync(ProviderUkprn, _uln, _evaluateSendConfirmation).Returns(_learnerRecord); CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheModel); }
public override void Given() { learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true, HasLrsEnglishAndMaths = true, IsSendConfirmationRequired = true }; ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; cacheResult = new AddLearnerRecordViewModel { LearnerRecord = learnerRecord, Uln = ulnViewModel, }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(cacheResult); }
public override void Given() { _learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true }; _ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = _learnerRecord, Uln = _ulnViewModel, EnglishAndMathsQuestion = new EnglishAndMathsQuestionViewModel() }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
private async Task SyncCacheUln(EnterUlnViewModel model, FindLearnerRecord learnerRecord = null) { var cacheModel = await _cacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey); if (cacheModel?.Uln != null && cacheModel?.Uln?.EnterUln == model.EnterUln) { cacheModel.LearnerRecord = learnerRecord; cacheModel.Uln = model; } else { cacheModel = new AddLearnerRecordViewModel { LearnerRecord = learnerRecord, Uln = model } }; await _cacheService.SetAsync(CacheKey, cacheModel); } }
public override void Given() { learnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", IsLearnerRegistered = true, IsLearnerRecordAdded = false }; ulnViewModel = new EnterUlnViewModel { EnterUln = "1234567890" }; EnglishAndMathsQuestionViewModel = new EnglishAndMathsQuestionViewModel { EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved }; _cacheResult = new AddLearnerRecordViewModel { LearnerRecord = learnerRecord, Uln = ulnViewModel }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(_cacheResult); }
public override void Given() { _searchLearnerRecordViewModel = new SearchLearnerRecordViewModel { SearchUln = "1234567890" }; LearnerRecord = new FindLearnerRecord { Uln = 1234567890, Name = "Test Name", DateofBirth = DateTime.UtcNow.AddYears(-30), ProviderName = "Barnsley College (123456789)", IsLearnerRegistered = true, IsLearnerRecordAdded = false, HasLrsEnglishAndMaths = false }; EnterUlnViewModel = new EnterUlnViewModel { EnterUln = _searchLearnerRecordViewModel.SearchUln, IsNavigatedFromSearchLearnerRecordNotAdded = true }; EnglishAndMathsQuestionViewModel = new EnglishAndMathsQuestionViewModel { EnglishAndMathsStatus = EnglishAndMathsStatus.AchievedWithSend }; IndustryPlacementQuestionViewModel = new IndustryPlacementQuestionViewModel { LearnerName = LearnerRecord.Name, IndustryPlacementStatus = IndustryPlacementStatus.Completed }; AddLearnerRecordViewModel = new AddLearnerRecordViewModel { LearnerRecord = LearnerRecord, Uln = EnterUlnViewModel, EnglishAndMathsQuestion = EnglishAndMathsQuestionViewModel, IndustryPlacementQuestion = IndustryPlacementQuestionViewModel }; AddLearnerRecordResponse = new AddLearnerRecordResponse { IsSuccess = true, Uln = LearnerRecord.Uln, Name = LearnerRecord.Name }; CacheService.GetAsync <SearchLearnerRecordViewModel>(CacheKey).Returns(_searchLearnerRecordViewModel); CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(AddLearnerRecordViewModel); TrainingProviderLoader.AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel).Returns(AddLearnerRecordResponse); }
public async Task <AddLearnerRecordResponse> AddLearnerRecordAsync(long providerUkprn, AddLearnerRecordViewModel viewModel) { var learnerRecordModel = _mapper.Map <AddLearnerRecordRequest>(viewModel, opt => opt.Items["providerUkprn"] = providerUkprn); return(await _internalApiClient.AddLearnerRecordAsync(learnerRecordModel)); }