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 Setup()
        {
            _tokenServiceClient = Substitute.For <ITokenServiceClient>();

            _configuration = new ResultsAndCertificationConfiguration
            {
                ResultsAndCertificationInternalApiSettings = new ResultsAndCertificationInternalApiSettings {
                    Uri = "http://tlevel.api.com"
                }
            };

            _mockHttpResult = new AddLearnerRecordResponse
            {
                Uln       = 1234567891,
                Name      = "Test User",
                IsSuccess = true
            };

            _model = new AddLearnerRecordRequest
            {
                Ukprn = 58974561,
                Uln   = 1234567891,
                HasLrsEnglishAndMaths   = false,
                EnglishAndMathsStatus   = EnglishAndMathsStatus.AchievedWithSend,
                IndustryPlacementStatus = IndustryPlacementStatus.Completed,
                PerformedBy             = "Test User"
            };
        }
Beispiel #3
0
        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()
        {
            _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 override Task When()
 {
     _result = await _apiClient.AddLearnerRecordAsync(_model);
 }
 public async override Task When()
 {
     ActualResult = await Loader.AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel);
 }