Ejemplo n.º 1
0
            public async Task WhenInitiatePasswordResetGetsCalled()
            {
                Setup();

                _user = new Fixture().Build <User>().With(usr => usr.Id, _userId).Create();

                _expectedAction = new Action(_userId, ActionType.ResetPassword);

                ActionsRepository.Setup(repository => repository.CreateAction(It.IsAny <Action>()))
                .Callback <Action>(action => _usedAction = action);
                UsersRepository.Setup(repository => repository.GetUserById(It.IsAny <Guid>()))
                .ReturnsAsync(_user);

                await AccountService.InitiatePasswordReset(_userId, Email);
            }
Ejemplo n.º 2
0
            public async Task WhenCompletePasswordResetGetsCalled()
            {
                Setup();

                var fixture = new Fixture();

                _action = fixture.Create <Action>();
                _resetPasswordRequest          = fixture.Create <ResetPasswordRequest>();
                _resetPasswordRequest.ActionId = _action.Id;

                ActionsRepository.Setup(repository => repository.GetActionById(It.IsAny <Guid>())).ReturnsAsync(_action);
                ActionValidator.Setup(validator => validator.ValidateAction(It.IsAny <Action>(), It.IsAny <ActionType>()))
                .Returns(new List <Error>());

                _result = await AccountsController.ResetPassword(_resetPasswordRequest);
            }
Ejemplo n.º 3
0
            public async Task WhenCompletePasswordResetGetsCalled()
            {
                Setup();

                var fixture = new Fixture();

                _action = fixture.Create <Action>();
                _resetPasswordRequest = fixture.Create <ResetPasswordRequest>();
                _resetPasswordRequest.ConfirmNewPassword = _resetPasswordRequest.NewPassword;
                _resetPasswordRequest.ActionId           = _action.Id;

                ActionsRepository.Setup(repository => repository.GetActionById(It.IsAny <Guid>())).ReturnsAsync(_action);
                ActionValidator.Setup(validator => validator.ValidateAction(It.IsAny <Action>(), It.IsAny <ActionType>()))
                .Returns(new List <Error>());
                CryptographyService.Setup(service => service.HashAndSaltPassword(It.IsAny <string>()))
                .Returns("HashedAndSalted");

                _result = await AccountsController.ResetPassword(_resetPasswordRequest);
            }