public void GivenUserConfirmationEmail_WhenReceivesCorrectData_ThenShouldCallEmailBuilderService() { var userConfirmationEmail = new UserConfirmationEmail(_mockUserManager, _mockEmailBuilder, _mockEventBus); userConfirmationEmail.Send(_user); _mockEmailBuilder.Received().ConfirmationEmail(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }
GivenForgotPasswordQueryHandler_WhenReceivesCorrectCommand_ThenShouldCallEmailBuilderToGetPasswordResetEmail() { _mockUserManager.FindByEmailAsync(_query.Email).ReturnsForAnyArgs(_user); var forgotPasswordQueryHandler = new ForgotPasswordCommandHandler(_mockUserManager, _mockEmailBuilder, _mockEventBus); await forgotPasswordQueryHandler.Handle(_query, CancellationToken.None); _mockEmailBuilder.Received().ResetPasswordEmail(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }
public async Task GivenResetPasswordCommandHandler_WhenPasswordHasBeenReset_ThenShouldCallEmailBuilder() { _mockUserManager.FindByEmailAsync(_command.Email).ReturnsForAnyArgs(_user); _mockUserManager.ResetPasswordAsync(_user, _command.ResetPasswordToken, _command.NewPassword) .ReturnsForAnyArgs(Task.FromResult(IdentityResult.Success)); var resetPasswordCommandHandler = new ResetPasswordCommandHandler(_mockUserManager, _mockEventBus, _mockEmailBuilder, _mockFailedIdentityResult); await resetPasswordCommandHandler.Handle(_command, CancellationToken.None); _mockEmailBuilder.Received().PasswordChangedEmail(Arg.Any <string>()); }