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 void Then_Expected_Methods_AreCalled()
        {
            TrainingProviderLoader.Received(1).FindLearnerRecordAsync(ProviderUkprn, uln, _evaluteSendConfirmation);

            CacheService.Received(1).GetAsync <AddLearnerRecordViewModel>(CacheKey);
            CacheService.Received(1).SetAsync(CacheKey, Arg.Any <AddLearnerRecordViewModel>());
        }
        public override void Given()
        {
            CreateMapper();
            ProviderUkprn         = 987654321;
            ProfileId             = 1;
            RegistrationPathwayId = 1;

            _expectedApiResult = new LearnerRecordDetails {
                ProfileId = ProfileId, Uln = 1234567890, Name = "Test User", IsLearnerRecordAdded = true, IndustryPlacementStatus = IndustryPlacementStatus.Completed
            };
            ViewModel = new UpdateIndustryPlacementQuestionViewModel {
                ProfileId = ProfileId, RegistrationPathwayId = RegistrationPathwayId, IndustryPlacementId = 0, IndustryPlacementStatus = IndustryPlacementStatus.NotCompleted
            };

            InternalApiClient.GetLearnerRecordDetailsAsync(ProviderUkprn, ProfileId, RegistrationPathwayId).Returns(_expectedApiResult);
            InternalApiClient.UpdateLearnerRecordAsync(Arg.Is <UpdateLearnerRecordRequest>
                                                           (x => x.ProfileId == ViewModel.ProfileId &&
                                                           x.Ukprn == ProviderUkprn &&
                                                           x.RegistrationPathwayId == ViewModel.RegistrationPathwayId &&
                                                           x.IndustryPlacementId == ViewModel.IndustryPlacementId &&
                                                           x.IndustryPlacementStatus == ViewModel.IndustryPlacementStatus &&
                                                           x.PerformedBy == $"{Givenname} {Surname}"))
            .Returns(false);

            Loader = new TrainingProviderLoader(InternalApiClient, Mapper);
        }
示例#4
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()
 {
     ProfileId  = 10;
     mockresult = new LearnerRecordDetailsViewModel
     {
         ProfileId             = 10,
         HasLrsEnglishAndMaths = false,
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <LearnerRecordDetailsViewModel>(ProviderUkprn, ProfileId).Returns(mockresult);
 }
 public void Then_Expected_Methods_Called()
 {
     TrainingProviderLoader.Received(1).ProcessEnglishAndMathsQuestionUpdateAsync(ProviderUkprn, ViewModel);
     CacheService.Received(1).SetAsync(string.Concat(CacheKey, Constants.EnglishAndMathsAchievementUpdatedConfirmation),
                                       Arg.Is <UpdateLearnerRecordResponseViewModel>
                                           (x => x.ProfileId == _updateLearnerRecordResponse.ProfileId &&
                                           x.Name == _updateLearnerRecordResponse.Name &&
                                           x.Uln == _updateLearnerRecordResponse.Uln),
                                       CacheExpiryTime.XSmall);
 }
示例#7
0
 public override void Given()
 {
     SearchLearnerRecordViewModel = new SearchLearnerRecordViewModel {
         SearchUln = uln.ToString()
     };
     mockResult = new FindLearnerRecord {
         IsLearnerRegistered = false
     };
     TrainingProviderLoader.FindLearnerRecordAsync(ProviderUkprn, SearchLearnerRecordViewModel.SearchUln.ToLong()).Returns(mockResult);
 }
 public override void Given()
 {
     ProfileId  = 10;
     mockresult = new UpdateEnglishAndMathsQuestionViewModel
     {
         ProfileId            = ProfileId,
         IsLearnerRecordAdded = false
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <UpdateEnglishAndMathsQuestionViewModel>(ProviderUkprn, ProfileId).Returns(mockresult);
 }
 public override void Given()
 {
     EnterUlnViewModel = new EnterUlnViewModel {
         EnterUln = uln.ToString()
     };
     mockResult = new FindLearnerRecord {
         IsLearnerRegistered = false
     };
     TrainingProviderLoader.FindLearnerRecordAsync(ProviderUkprn, uln, _evaluteSendConfirmation).Returns(mockResult);
 }
示例#10
0
 public override void Given()
 {
     ProfileId  = 10;
     Mockresult = new LearnerRecordDetailsViewModel
     {
         ProfileId            = 10,
         IsLearnerRegistered  = false,
         IsLearnerRecordAdded = false
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <LearnerRecordDetailsViewModel>(ProviderUkprn, ProfileId).Returns(Mockresult);
 }
 public override void Given()
 {
     _profileId        = 1;
     EnterUlnViewModel = new EnterUlnViewModel {
         EnterUln = _uln.ToString()
     };
     _mockResult = new FindLearnerRecord {
         ProfileId = _profileId, IsLearnerRegistered = true, IsLearnerRecordAdded = true
     };
     TrainingProviderLoader.FindLearnerRecordAsync(ProviderUkprn, _uln, _evaluteSendConfirmation).Returns(_mockResult);
 }
 public void Then_Expected_Methods_Called()
 {
     TrainingProviderLoader.Received(1).AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel);
     CacheService.Received(1).RemoveAsync <SearchLearnerRecordViewModel>(CacheKey);
     CacheService.Received(1).RemoveAsync <AddLearnerRecordViewModel>(CacheKey);
     CacheService.Received(1).SetAsync(string.Concat(CacheKey, Constants.AddLearnerRecordConfirmation),
                                       Arg.Is <LearnerRecordConfirmationViewModel>
                                           (x => x.Name == AddLearnerRecordViewModel.LearnerRecord.Name &&
                                           x.Uln == AddLearnerRecordViewModel.LearnerRecord.Uln),
                                       CacheExpiryTime.XSmall);
 }
 public override void Given()
 {
     ProfileId  = 10;
     PathwayId  = 15;
     mockresult = new UpdateIndustryPlacementQuestionViewModel
     {
         ProfileId             = ProfileId,
         RegistrationPathwayId = PathwayId,
         IsLearnerRecordAdded  = false
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <UpdateIndustryPlacementQuestionViewModel>(ProviderUkprn, ProfileId, PathwayId).Returns(mockresult);
 }
 public override void Given()
 {
     ProfileId  = 10;
     mockresult = new UpdateEnglishAndMathsQuestionViewModel
     {
         ProfileId             = ProfileId,
         LearnerName           = "Test user",
         IsLearnerRecordAdded  = true,
         EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <UpdateEnglishAndMathsQuestionViewModel>(ProviderUkprn, ProfileId).Returns(mockresult);
 }
        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);
        }
示例#16
0
        public override void Given()
        {
            _updateLearnerRecordResponse = null;

            ViewModel = new UpdateEnglishAndMathsQuestionViewModel
            {
                ProfileId             = 1,
                EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved
            };

            TrainingProviderLoader.ProcessEnglishAndMathsQuestionUpdateAsync(ProviderUkprn, ViewModel).Returns(_updateLearnerRecordResponse);
        }
        public override void Given()
        {
            _updateLearnerRecordResponse = null;

            UpdateIndustryPlacementQuestionViewModel = new UpdateIndustryPlacementQuestionViewModel
            {
                ProfileId = 1,
                IndustryPlacementStatus = IndustryPlacementStatus.Completed
            };

            TrainingProviderLoader.ProcessIndustryPlacementQuestionUpdateAsync(ProviderUkprn, UpdateIndustryPlacementQuestionViewModel).Returns(_updateLearnerRecordResponse);
        }
示例#18
0
 public override void Given()
 {
     ProfileId  = 10;
     PathwayId  = 15;
     mockresult = new UpdateIndustryPlacementQuestionViewModel
     {
         ProfileId               = ProfileId,
         RegistrationPathwayId   = PathwayId,
         LearnerName             = "Test user",
         IsLearnerRecordAdded    = true,
         IndustryPlacementStatus = IndustryPlacementStatus.Completed
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <UpdateIndustryPlacementQuestionViewModel>(ProviderUkprn, ProfileId, PathwayId).Returns(mockresult);
 }
示例#19
0
        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()
        {
            _updateLearnerRecordResponse = new UpdateLearnerRecordResponseViewModel
            {
                ProfileId  = 1,
                Uln        = 1234567890,
                Name       = "Test User",
                IsModified = true,
                IsSuccess  = true
            };

            ViewModel = new UpdateEnglishAndMathsQuestionViewModel
            {
                ProfileId             = 1,
                EnglishAndMathsStatus = EnglishAndMathsStatus.Achieved
            };

            TrainingProviderLoader.ProcessEnglishAndMathsQuestionUpdateAsync(ProviderUkprn, ViewModel).Returns(_updateLearnerRecordResponse);
        }
        public override void Given()
        {
            _updateLearnerRecordResponse = new UpdateLearnerRecordResponseViewModel
            {
                ProfileId  = 1,
                Uln        = 1234567890,
                Name       = "Test User",
                IsModified = true,
                IsSuccess  = false
            };

            UpdateIndustryPlacementQuestionViewModel = new UpdateIndustryPlacementQuestionViewModel
            {
                ProfileId               = 1,
                RegistrationPathwayId   = 1,
                IndustryPlacementStatus = IndustryPlacementStatus.Completed
            };

            TrainingProviderLoader.ProcessIndustryPlacementQuestionUpdateAsync(ProviderUkprn, UpdateIndustryPlacementQuestionViewModel).Returns(_updateLearnerRecordResponse);
        }
示例#22
0
 public override void Given()
 {
     ProfileId  = 10;
     Mockresult = new LearnerRecordDetailsViewModel
     {
         ProfileId             = 10,
         RegistrationPathwayId = 15,
         Uln                       = 1235469874,
         Name                      = "Test user",
         DateofBirth               = DateTime.UtcNow.AddYears(-20),
         ProviderName              = "Barsley College (58794528)",
         PathwayName               = "Test Pathway Name (97453214)",
         IsLearnerRegistered       = true,
         IsLearnerRecordAdded      = true,
         IsEnglishAndMathsAchieved = true,
         IsSendLearner             = true,
         HasLrsEnglishAndMaths     = true,
         IndustryPlacementId       = 10,
         IndustryPlacementStatus   = IndustryPlacementStatus.Completed
     };
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <LearnerRecordDetailsViewModel>(ProviderUkprn, ProfileId).Returns(Mockresult);
 }
        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 override void Given()
        {
            CreateMapper();
            ProviderUkprn = 987654321;
            ProfileId     = 1;

            _expectedApiResult = new LearnerRecordDetails {
                ProfileId = ProfileId, Uln = 1234567890, Name = "Test User", IsLearnerRecordAdded = true, HasLrsEnglishAndMaths = false, IsEnglishAndMathsAchieved = true, IsSendLearner = false
            };
            ViewModel = new UpdateEnglishAndMathsQuestionViewModel {
                ProfileId = ProfileId, EnglishAndMathsStatus = EnglishAndMathsStatus.AchievedWithSend
            };

            InternalApiClient.GetLearnerRecordDetailsAsync(ProviderUkprn, ProfileId).Returns(_expectedApiResult);
            InternalApiClient.UpdateLearnerRecordAsync(Arg.Is <UpdateLearnerRecordRequest>
                                                           (x => x.ProfileId == ViewModel.ProfileId &&
                                                           x.Ukprn == ProviderUkprn &&
                                                           x.Uln == _expectedApiResult.Uln &&
                                                           x.EnglishAndMathsStatus == ViewModel.EnglishAndMathsStatus &&
                                                           x.PerformedBy == $"{Givenname} {Surname}"))
            .Returns(true);

            Loader = new TrainingProviderLoader(InternalApiClient, Mapper);
        }
 public void Then_Expected_Methods_Called()
 {
     TrainingProviderLoader.Received(1).ProcessIndustryPlacementQuestionUpdateAsync(ProviderUkprn, UpdateIndustryPlacementQuestionViewModel);
 }
 public void Then_Expected_Methods_AreCalled()
 {
     TrainingProviderLoader.Received(1).GetLearnerRecordDetailsAsync <LearnerRecordDetailsViewModel>(ProviderUkprn, ProfileId);
 }
示例#27
0
 public void Then_Expected_Methods_AreCalled()
 {
     TrainingProviderLoader.Received(1).GetLearnerRecordDetailsAsync <UpdateIndustryPlacementQuestionViewModel>(ProviderUkprn, ProfileId, PathwayId);
 }
示例#28
0
 public override void Given()
 {
     ProfileId = 0;
     TrainingProviderLoader.GetLearnerRecordDetailsAsync <LearnerRecordDetailsViewModel>(ProviderUkprn, ProfileId).Returns(mockresult);
 }
示例#29
0
 public void Then_Expected_Methods_Called()
 {
     TrainingProviderLoader.Received(1).ProcessEnglishAndMathsQuestionUpdateAsync(ProviderUkprn, ViewModel);
 }
 public void Then_Expected_Methods_Called()
 {
     TrainingProviderLoader.Received(1).AddLearnerRecordAsync(ProviderUkprn, AddLearnerRecordViewModel);
     CacheService.DidNotReceive().RemoveAsync <AddLearnerRecordViewModel>(CacheKey);
 }