public override void Given()
        {
            _selectedAcademicYear = ((int)AcademicYear.Year2020).ToString();
            _ulnViewModel         = new UlnViewModel {
                Uln = "1234567890"
            };
            _learnersNameViewModel = new LearnersNameViewModel {
                Firstname = "First", Lastname = "Last"
            };
            _dateofBirthViewModel = new DateofBirthViewModel {
                Day = "01", Month = "01", Year = "2020"
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = "98765432", SelectedProviderDisplayName = "Barnsley College (98765432)"
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = _coreCode, SelectedCoreDisplayName = $"Education ({_coreCode})", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = _coreCode
                    }
                }
            };
            _specialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = true
            };
            _pathwaySpecialismsViewModel = new PathwaySpecialismsViewModel {
                PathwayCode = _coreCode, PathwayName = "Education", Specialisms = new List <SpecialismDetailsViewModel> {
                    new SpecialismDetailsViewModel {
                        Code = "7654321", Name = "Test Education", DisplayName = "Test Education (7654321)", IsSelected = true
                    }
                }
            };
            _academicYearViewModel = new SelectAcademicYearViewModel {
                SelectedAcademicYear = _selectedAcademicYear.ToString()
            };

            cacheResult = new RegistrationViewModel
            {
                Uln                = _ulnViewModel,
                LearnersName       = _learnersNameViewModel,
                DateofBirth        = _dateofBirthViewModel,
                SelectProvider     = _selectProviderViewModel,
                SelectCore         = _selectCoreViewModel,
                SpecialismQuestion = _specialismQuestionViewModel,
                SelectAcademicYear = _academicYearViewModel
            };

            _pathwaySpecialismsViewModel = new PathwaySpecialismsViewModel {
                PathwayName = "Test Pathway", Specialisms = new List <SpecialismDetailsViewModel> {
                    new SpecialismDetailsViewModel {
                        Id = 1, Code = "345678", Name = "Test Specialism", DisplayName = "Test Specialism (345678)", IsSelected = true
                    }
                }
            };
            SelectSpecialismViewModel = new SelectSpecialismViewModel {
                IsChangeMode = true
            };
            RegistrationLoader.GetPathwaySpecialismsByPathwayLarIdAsync(Ukprn, _coreCode).Returns(_pathwaySpecialismsViewModel);
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
Ejemplo n.º 2
0
        public override void Given()
        {
            SelectCoreViewModel = new SelectCoreViewModel();
            Controller.ModelState.AddModelError("SelectedCoreCode", SelectCoreContent.Validation_Select_Core_Required);

            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Test Provider", Value = _providerUkprn.ToString()
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };

            var cacheResult = new RegistrationViewModel
            {
                SelectProvider = _selectProviderViewModel,
                SelectCore     = _selectCoreViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(Ukprn, _providerUkprn).Returns(_selectCoreViewModel);
        }
        public override void Given()
        {
            _dateOfBirthViewModel = new DateofBirthViewModel {
                Day = DateTime.Now.Day.ToString(), Month = DateTime.Now.Month.ToString(), Year = DateTime.Now.Year.ToString()
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Hello", Value = "1"
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };
            cacheResult = new RegistrationViewModel
            {
                SelectProvider = _selectProviderViewModel
            };

            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(Ukprn, _providerUkprn).Returns(_selectCoreViewModel);
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public async Task <IActionResult> AddRegistrationCoreAsync(SelectCoreViewModel model)
        {
            var cacheModel = await _cacheService.GetAsync <RegistrationViewModel>(CacheKey);

            if (model == null || cacheModel?.SelectProvider == null)
            {
                return(RedirectToRoute(RouteConstants.PageNotFound));
            }

            var coreViewModel = await GetRegisteredProviderCores(cacheModel.SelectProvider.SelectedProviderUkprn.ToLong());

            if (!ModelState.IsValid)
            {
                model.CoreSelectList = coreViewModel.CoreSelectList;
                return(View(model));
            }

            if (cacheModel?.SelectCore?.SelectedCoreCode != model.SelectedCoreCode)
            {
                cacheModel.SpecialismQuestion = null;
                cacheModel.SelectSpecialisms  = null;
            }

            model.SelectedCoreDisplayName = coreViewModel?.CoreSelectList?.FirstOrDefault(p => p.Value == model.SelectedCoreCode)?.Text;
            cacheModel.SelectCore         = model;
            await _cacheService.SetAsync(CacheKey, cacheModel);

            return(model.IsChangeMode ? RedirectToRoute(RouteConstants.AddRegistrationSpecialismQuestion, new { isChangeMode = "true" }) : RedirectToRoute(RouteConstants.AddRegistrationSpecialismQuestion));
        }
Ejemplo n.º 5
0
        public override void Given()
        {
            SelectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "10000057", IsChangeMode = true
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Test Provider", Value = _providerUkprn.ToString()
                    }
                }
            };

            var cacheResult = new RegistrationViewModel
            {
                Uln = new UlnViewModel {
                    Uln = "1234567890"
                },
                LearnersName = new LearnersNameViewModel {
                    Firstname = "First", Lastname = "Last"
                },
                DateofBirth = new DateofBirthViewModel {
                    Day = "01", Month = "01", Year = "2020"
                },
                SelectProvider = _selectProviderViewModel,
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
Ejemplo n.º 6
0
        public override void Given()
        {
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Hello", Value = "1"
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };
            cacheResult = new RegistrationViewModel
            {
                SelectProvider = _selectProviderViewModel,
                SelectCore     = _selectCoreViewModel
            };

            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(Ukprn, _providerUkprn).Returns(_selectCoreViewModel);
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            _reregisterProviderViewModel = new ReregisterProviderViewModel {
                ProfileId = ProfileId, SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Hello", Value = "1"
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };

            var cacheResult = new ReregisterViewModel
            {
                ReregisterProvider = _reregisterProviderViewModel
            };

            CacheService.GetAsync <ReregisterViewModel>(CacheKey).Returns(cacheResult);
            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(AoUkprn, _providerUkprn).Returns(_selectCoreViewModel);
            Controller.ModelState.AddModelError(nameof(ReregisterCoreViewModel.SelectedCoreCode), SelectCoreContent.Validation_Select_Core_Required);
        }
Ejemplo n.º 8
0
        public override void Given()
        {
            IsChangeMode  = true;
            _ulnViewModel = new UlnViewModel {
                Uln = "1234567890"
            };
            _learnersNameViewModel = new LearnersNameViewModel {
                Firstname = "First", Lastname = "Last"
            };
            _dateofBirthViewModel = new DateofBirthViewModel {
                Day = "01", Month = "01", Year = "2020"
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = "98765432", SelectedProviderDisplayName = "Barnsley College (98765432)"
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = _coreCode, SelectedCoreDisplayName = $"Education ({_coreCode})", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = _coreCode
                    }
                }
            };

            cacheResult = new RegistrationViewModel
            {
                Uln            = _ulnViewModel,
                LearnersName   = _learnersNameViewModel,
                DateofBirth    = _dateofBirthViewModel,
                SelectProvider = _selectProviderViewModel,
                SelectCore     = _selectCoreViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
Ejemplo n.º 9
0
        public override void Given()
        {
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = _coreCode, CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = _coreCode
                    }
                }
            };
            _specialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = true
            };
            cacheResult = new RegistrationViewModel
            {
                SelectCore         = _selectCoreViewModel,
                SpecialismQuestion = _specialismQuestionViewModel
            };

            _pathwaySpecialismsViewModel = new PathwaySpecialismsViewModel {
                PathwayName = "Test Pathway", Specialisms = new List <SpecialismDetailsViewModel> {
                    new SpecialismDetailsViewModel {
                        Id = 1, Code = "345678", Name = "Test Specialism", DisplayName = "Test Specialism (345678)"
                    }
                }
            };
            RegistrationLoader.GetPathwaySpecialismsByPathwayLarIdAsync(Ukprn, _coreCode).Returns(_pathwaySpecialismsViewModel);
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            _reregisterProviderViewModel = new ReregisterProviderViewModel {
                ProfileId = ProfileId, SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Hello", Value = "1"
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };
            _registrationDetailsViewModel = new RegistrationDetailsViewModel
            {
                ProfileId    = ProfileId,
                PathwayLarId = _coreCodeAtTheTimeOfWithdrawn,
                Status       = _registrationPathwayStatus
            };

            var cacheResult = new ReregisterViewModel
            {
                ReregisterProvider = _reregisterProviderViewModel
            };

            ViewModel.ProfileId        = ProfileId;
            ViewModel.SelectedCoreCode = _selectedCoreCode;

            CacheService.GetAsync <ReregisterViewModel>(CacheKey).Returns(cacheResult);
            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(AoUkprn, _providerUkprn).Returns(_selectCoreViewModel);
            RegistrationLoader.GetRegistrationDetailsAsync(AoUkprn, ProfileId, RegistrationPathwayStatus.Withdrawn).Returns(_registrationDetailsViewModel);
        }
        public override void Given()
        {
            _routeAttributes = new Dictionary <string, string> {
                { Constants.IsChangeMode, "true" }
            };
            _ulnViewModel = new UlnViewModel {
                Uln = "1234567890"
            };
            _learnersNameViewModel = new LearnersNameViewModel {
                Firstname = "First", Lastname = "Last"
            };
            _dateofBirthViewModel = new DateofBirthViewModel {
                Day = "01", Month = "01", Year = "2020"
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = "98765432", SelectedProviderDisplayName = "Barnsley College (98765432)"
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = _coreCode, SelectedCoreDisplayName = $"Education ({_coreCode})", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = _coreCode
                    }
                }
            };
            _specialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = true
            };
            _pathwaySpecialismsViewModel = new PathwaySpecialismsViewModel {
                PathwayCode = _coreCode, PathwayName = "Education", Specialisms = new List <SpecialismDetailsViewModel> {
                    new SpecialismDetailsViewModel {
                        Code = "7654321", Name = "Test Education", DisplayName = "Test Education (7654321)", IsSelected = true
                    }
                }
            };
            _selectSpecialismViewModel = new SelectSpecialismViewModel {
                PathwaySpecialisms = _pathwaySpecialismsViewModel
            };
            _academicYearViewModel = new SelectAcademicYearViewModel {
                SelectedAcademicYear = "2020"
            };

            cacheResult = new RegistrationViewModel
            {
                Uln                = _ulnViewModel,
                LearnersName       = _learnersNameViewModel,
                DateofBirth        = _dateofBirthViewModel,
                SelectProvider     = _selectProviderViewModel,
                SelectCore         = _selectCoreViewModel,
                SpecialismQuestion = _specialismQuestionViewModel,
                SelectSpecialisms  = _selectSpecialismViewModel,
                SelectAcademicYear = _academicYearViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            _selectCoreViewModel = new SelectCoreViewModel {
                CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };
            cacheResult = new RegistrationViewModel
            {
                SelectCore = _selectCoreViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
Ejemplo n.º 13
0
        public override void Given()
        {
            _selectedAcademicYear = ((int)AcademicYear.Year2020).ToString();
            _ulnViewModel         = new UlnViewModel {
                Uln = "1234567890"
            };
            _learnersNameViewModel = new LearnersNameViewModel {
                Firstname = "First", Lastname = "Last"
            };
            _dateofBirthViewModel = new DateofBirthViewModel {
                Day = "01", Month = "01", Year = "2020"
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = "98765432", SelectedProviderDisplayName = "Barnsley College (98765432)"
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = _coreCode, SelectedCoreDisplayName = $"Education ({_coreCode})", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = _coreCode
                    }
                }
            };
            _specialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = true
            };
            _academicYearViewModel = new SelectAcademicYearViewModel {
                SelectedAcademicYear = _selectedAcademicYear.ToString()
            };

            cacheResult = new RegistrationViewModel
            {
                Uln                = _ulnViewModel,
                LearnersName       = _learnersNameViewModel,
                DateofBirth        = _dateofBirthViewModel,
                SelectProvider     = _selectProviderViewModel,
                SelectCore         = _selectCoreViewModel,
                SpecialismQuestion = _specialismQuestionViewModel,
                SelectAcademicYear = _academicYearViewModel
            };

            SpecialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = false, IsChangeMode = true
            };
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            SpecialismQuestionViewModel = new SpecialismQuestionViewModel {
                HasLearnerDecidedSpecialism = true
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };
            cacheResult = new RegistrationViewModel
            {
                SelectCore = _selectCoreViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            SpecialismQuestionViewModel = new SpecialismQuestionViewModel();
            Controller.ModelState.AddModelError("HasLearnerDecidedSpecialism", SpecialismQuestionContent.Validation_Select_Yes_Required_Message);

            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };

            cacheResult = new RegistrationViewModel
            {
                SelectCore = _selectCoreViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
Ejemplo n.º 16
0
        public override void Given()
        {
            SelectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "10000057"
            };

            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Test Provider", Value = _providerUkprn.ToString()
                    }
                }
            };

            var cacheResult = new RegistrationViewModel
            {
                SelectProvider = _selectProviderViewModel
            };

            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
        public override void Given()
        {
            IsChangeMode  = true;
            _ulnViewModel = new UlnViewModel {
                Uln = "1234567890"
            };
            _learnersNameViewModel = new LearnersNameViewModel {
                Firstname = "First", Lastname = "Last"
            };
            _dateofBirthViewModel = new DateofBirthViewModel {
                Day = "01", Month = "01", Year = "2020"
            };
            _selectProviderViewModel = new SelectProviderViewModel {
                SelectedProviderUkprn = _providerUkprn.ToString(), SelectedProviderDisplayName = "Barnsley College (98765432)", ProvidersSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Barnsley College (98765432)", Value = _providerUkprn.ToString()
                    }
                }
            };
            _selectCoreViewModel = new SelectCoreViewModel {
                SelectedCoreCode = "123", CoreSelectList = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Education", Value = "123"
                    }
                }
            };

            cacheResult = new RegistrationViewModel
            {
                Uln            = _ulnViewModel,
                LearnersName   = _learnersNameViewModel,
                DateofBirth    = _dateofBirthViewModel,
                SelectProvider = _selectProviderViewModel,
                SelectCore     = _selectCoreViewModel
            };

            RegistrationLoader.GetRegisteredProviderPathwayDetailsAsync(Ukprn, _providerUkprn).Returns(_selectCoreViewModel);
            CacheService.GetAsync <RegistrationViewModel>(CacheKey).Returns(cacheResult);
        }
 public IViewComponentResult Invoke(SelectCoreViewModel model)
 {
     return(View("~/ViewComponents/Registration/SelectCore/Index.cshtml", model));
 }
Ejemplo n.º 19
0
 public async override Task When()
 {
     ActualResult = await Loader.GetRegisteredProviderPathwayDetailsAsync(Ukprn, ProviderUkprn);
 }