Exemplo n.º 1
0
 public override void Given()
 {
     ApiClientResponse = true;
     ViewModel         = new WithdrawRegistrationViewModel {
         ProfileId = 1, Uln = Uln
     };
     Loader          = new RegistrationLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
     withdrawRequest = new WithdrawRegistrationRequest {
         AoUkprn = AoUkprn, ProfileId = ProfileId, PerformedBy = $"{Givenname} {Surname}"
     };
     InternalApiClient.WithdrawRegistrationAsync(Arg.Any <WithdrawRegistrationRequest>()).Returns(ApiClientResponse);
 }
Exemplo n.º 2
0
        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 WithdrawRegistrationViewModel();
        }
Exemplo n.º 3
0
 public override void Given()
 {
     ViewModel = new WithdrawRegistrationViewModel();
     Controller.ModelState.AddModelError(nameof(WithdrawRegistrationViewModel.CanWithdraw), WithdrawRegistrationContent.Select_Withdraw_Validation_Message);
 }
Exemplo n.º 4
0
        public async Task <WithdrawRegistrationResponse> WithdrawRegistrationAsync(long aoUkprn, WithdrawRegistrationViewModel viewModel)
        {
            var model     = _mapper.Map <WithdrawRegistrationRequest>(viewModel, opt => opt.Items["aoUkprn"] = aoUkprn);
            var isSuccess = await _internalApiClient.WithdrawRegistrationAsync(model);

            return(new WithdrawRegistrationResponse {
                ProfileId = viewModel.ProfileId, Uln = viewModel.Uln, IsSuccess = isSuccess, IsRequestFromProviderAndCorePage = viewModel.IsRequestFromProviderAndCorePage
            });
        }