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() { 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" }; 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 = false }; CacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey).Returns(AddLearnerRecordViewModel); TrainingProviderLoader.AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel).Returns(AddLearnerRecordResponse); }
public async Task <IActionResult> AddIndustryPlacementQuestionAsync(IndustryPlacementQuestionViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var cacheModel = await _cacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey); if (cacheModel?.Uln == null) { return(RedirectToRoute(RouteConstants.PageNotFound)); } cacheModel.IndustryPlacementQuestion = model; await _cacheService.SetAsync(CacheKey, cacheModel); return(RedirectToRoute(RouteConstants.AddLearnerRecordCheckAndSubmit)); }
public override void Given() { IndustryPlacementQuestionViewModel = new IndustryPlacementQuestionViewModel(); Controller.ModelState.AddModelError("IndustryPlacementStatus", IndustryPlacementQuestionContent.Validation_Select_Industry_Placement_Required_Message); }