예제 #1
0
        public async Task ThenNewAccountIsNotCreated()
        {
            await _employerAccountOrchestrator.CreateMinimalUserAccountForSkipJourney(
                ArrangeModel(),
                It.IsAny <HttpContextBase>());

            _mediator.Verify(
                x => x.SendAsync <CreateUserAccountCommandResponse>(
                    It.IsAny <CreateUserAccountCommand>()),
                Times.Never());
        }
        public async Task ThenTheUserAccountIsCreatedWithTheCorrectValues()
        {
            //Arrange
            var model = ArrangeModel();

            //Act
            await _employerAccountOrchestrator.CreateMinimalUserAccountForSkipJourney(model, It.IsAny <HttpContextBase>());

            //Assert
            _mediator.Verify(x => x.SendAsync(It.Is <CreateUserAccountCommand>(
                                                  c => c.OrganisationName.Equals(model.OrganisationName)
                                                  )));
        }
        public async Task <ActionResult> SkipRegistration()
        {
            var request = new CreateUserAccountViewModel
            {
                UserId           = GetUserId(),
                OrganisationName = "MY ACCOUNT"
            };

            var response = await _employerAccountOrchestrator.CreateMinimalUserAccountForSkipJourney(request, HttpContext);

            var returnUrlCookie = _returnUrlCookieStorageService.Get(ReturnUrlCookieName);

            _returnUrlCookieStorageService.Delete(ReturnUrlCookieName);
            if (returnUrlCookie != null && !returnUrlCookie.Value.IsNullOrWhiteSpace())
            {
                return(Redirect(returnUrlCookie.Value));
            }

            return(RedirectToAction(ControllerConstants.IndexActionName, ControllerConstants.EmployerTeamControllerName, new { hashedAccountId = response.Data.HashedId }));
        }