public override void Given()
        {
            registrationApiClientResponse = new RegistrationDetails
            {
                ProfileId     = 1,
                Uln           = Uln,
                Firstname     = "Test",
                Lastname      = "Last",
                AoUkprn       = AoUkprn,
                ProviderUkprn = 34567890,
                PathwayLarId  = "10000112",
            };

            ViewModel = new ChangeSpecialismQuestionViewModel {
                ProfileId = 1, HasLearnerDecidedSpecialism = false
            };
            Loader = new RegistrationLoader(Mapper, Logger, InternalApiClient, BlobStorageService);

            InternalApiClient.GetRegistrationDetailsAsync(AoUkprn, ViewModel.ProfileId, RegistrationPathwayStatus.Active)
            .Returns(registrationApiClientResponse);

            InternalApiClient.UpdateRegistrationAsync(Arg.Is <ManageRegistration>
                                                          (x => x.Uln == registrationApiClientResponse.Uln &&
                                                          x.FirstName == registrationApiClientResponse.Firstname &&
                                                          x.LastName == registrationApiClientResponse.Lastname &&
                                                          x.ProviderUkprn == registrationApiClientResponse.ProviderUkprn &&
                                                          x.CoreCode == registrationApiClientResponse.PathwayLarId &&
                                                          x.SpecialismCodes.Count() == 0))
            .Returns(ApiClientResponse);
        }
예제 #2
0
 public override void Given()
 {
     ViewModel = new ChangeSpecialismQuestionViewModel {
         ProfileId = 1
     };
     InternalApiClient.GetRegistrationDetailsAsync(AoUkprn, Arg.Any <int>(), RegistrationPathwayStatus.Active)
     .Returns(mockResponse);
     Loader = new RegistrationLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
 }
        public override void Given()
        {
            mockresult = new ChangeSpecialismQuestionViewModel
            {
                ProfileId = 1,
                HasLearnerDecidedSpecialism = true
            };

            RegistrationLoader.GetRegistrationProfileAsync <ChangeSpecialismQuestionViewModel>(AoUkprn, ProfileId).Returns(mockresult);
        }
        public override void Given()
        {
            mockResponse = new RegistrationDetails
            {
                ProfileId     = 1,
                Uln           = Uln,
                Firstname     = "Test",
                Lastname      = "Last",
                AoUkprn       = AoUkprn,
                ProviderUkprn = 34567890,
                PathwayLarId  = "10000112",
            };

            ViewModel = new ChangeSpecialismQuestionViewModel {
                ProfileId = 1, HasLearnerDecidedSpecialism = null
            };
            InternalApiClient.GetRegistrationDetailsAsync(AoUkprn, Arg.Any <int>(), RegistrationPathwayStatus.Active)
            .Returns(mockResponse);
            Loader = new RegistrationLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
        public override void Setup()
        {
            HttpContextAccessor = Substitute.For <IHttpContextAccessor>();
            RegistrationLoader  = Substitute.For <IRegistrationLoader>();
            CacheService        = Substitute.For <ICacheService>();
            Logger     = Substitute.For <ILogger <ManageRegistrationController> >();
            Controller = new ManageRegistrationController(RegistrationLoader, CacheService, Logger);

            ProfileId = 1;
            AoUkprn   = 1234567890;
            var httpContext = new ClaimsIdentityBuilder <ManageRegistrationController>(Controller)
                              .Add(CustomClaimTypes.Ukprn, AoUkprn.ToString())
                              .Add(CustomClaimTypes.UserId, Guid.NewGuid().ToString())
                              .Build()
                              .HttpContext;

            HttpContextAccessor.HttpContext.Returns(httpContext);
            ViewModel  = new ChangeSpecialismQuestionViewModel();
            MockResult = new ManageRegistrationResponse();
        }
예제 #6
0
        public async Task <ManageRegistrationResponse> ProcessSpecialismQuestionChangeAsync(long aoUkprn, ChangeSpecialismQuestionViewModel viewModel)
        {
            var reg = await _internalApiClient.GetRegistrationDetailsAsync(aoUkprn, viewModel.ProfileId, RegistrationPathwayStatus.Active);

            if (reg == null || viewModel.HasLearnerDecidedSpecialism == null)
            {
                return(null);
            }

            var request = _mapper.Map <ManageRegistration>(reg);

            _mapper.Map(viewModel, request);
            var isSuccess = await _internalApiClient.UpdateRegistrationAsync(request);

            return(new ManageRegistrationResponse {
                ProfileId = request.ProfileId, Uln = request.Uln, IsModified = true, IsSuccess = isSuccess
            });
        }