public override void Given() { ApiClientResponse = true; ViewModel = new RejoinRegistrationViewModel { ProfileId = 1, Uln = Uln }; Loader = new RegistrationLoader(Mapper, Logger, InternalApiClient, BlobStorageService); reJoinRequest = new RejoinRegistrationRequest { AoUkprn = AoUkprn, ProfileId = ProfileId, PerformedBy = $"{Givenname} {Surname}" }; InternalApiClient.RejoinRegistrationAsync(Arg.Any <RejoinRegistrationRequest>()).Returns(ApiClientResponse); }
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 RejoinRegistrationViewModel(); }
public override void Given() { ViewModel = new RejoinRegistrationViewModel(); Controller.ModelState.AddModelError(nameof(RejoinRegistrationViewModel.CanRejoin), RejoinRegistrationContent.Select_Rejoin_Validation_Message); }
public async Task <RejoinRegistrationResponse> RejoinRegistrationAsync(long aoUkprn, RejoinRegistrationViewModel viewModel) { var model = _mapper.Map <RejoinRegistrationRequest>(viewModel, opt => opt.Items["aoUkprn"] = aoUkprn); var isSuccess = await _internalApiClient.RejoinRegistrationAsync(model); return(new RejoinRegistrationResponse { ProfileId = viewModel.ProfileId, Uln = viewModel.Uln, IsSuccess = isSuccess }); }