public async Task ThenTheCommandIsCalledByTheMediator()
        {
            //Arrange

            var actualResetCode = "123456";
            var model           = new PasswordResetViewModel {
                Email = ValidEmail, PasswordResetCode = actualResetCode, Password = "******", ConfirmPassword = "******"
            };

            //Act
            await _accountOrchestrator.ResetPassword(model);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.Is <PasswordResetCommand>(c => c.Email == ValidEmail && c.Password == "password" && c.ConfirmPassword == "passwordconfirm" && c.PasswordResetCode == actualResetCode)), Times.Once);
        }
Beispiel #2
0
        public async Task <ActionResult> ResetPassword(PasswordResetViewModel model)
        {
            var returnModel = await _accountOrchestrator.ResetPassword(model);

            if (returnModel?.FlashMessage?.ErrorMessages == null || !returnModel.FlashMessage.ErrorMessages.Any())
            {
                if (!string.IsNullOrEmpty(returnModel?.Data?.ReturnUrl))
                {
                    return(new RedirectResult(returnModel.Data.ReturnUrl));
                }

                var returnUrl = _owinWrapper.GetIdsReturnUrl();
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(new RedirectResult(returnUrl));
                }

                return(await RedirectToEmployerPortal());
            }

            return(View("ResetPassword", returnModel));
        }