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);
        }
Exemple #2
0
        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 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);
        }
Exemple #4
0
        public async Task <IActionResult> AddEnglishAndMathsQuestionAsync(EnglishAndMathsQuestionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var cacheModel = await _cacheService.GetAsync <AddLearnerRecordViewModel>(CacheKey);

            if (cacheModel?.Uln == null)
            {
                return(RedirectToRoute(RouteConstants.PageNotFound));
            }

            cacheModel.EnglishAndMathsQuestion = model;
            await _cacheService.SetAsync(CacheKey, cacheModel);

            return(RedirectToRoute(model.IsChangeMode ? RouteConstants.AddLearnerRecordCheckAndSubmit : RouteConstants.AddIndustryPlacementQuestion));
        }
        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);
        }
Exemple #6
0
 public override void Given()
 {
     EnglishAndMathsQuestionViewModel = new EnglishAndMathsQuestionViewModel();
     Controller.ModelState.AddModelError("EnglishAndMathsStatus", EnglishAndMathsQuestionContent.Validation_Select_Is_EnglishMaths_Achieved_Required_Message);
 }