public ResetPasswordAccountTests() { validator = new ResetPasswordAccountValidation(); command = new ResetPasswordAccount( "*****@*****.**", "password", "code" ); }
public ResetPasswordAccountHandlerTests() { fakeAccountRepository = new Mock <IAccountRepository>(); fakeAccount = new Mock <Account>(); command = new ResetPasswordAccount( "*****@*****.**", "password", "code" ); identityResultSuccess = IdentityResult.Success; identityResultFailed = IdentityResult.Failed(); }
public async Task Reset_password_account_returns_success() { var fakeCommand = new ResetPasswordAccount("*****@*****.**", "password", "code"); CommandResponse commandResponse = new SuccessCommandResponse(); var fakeAccountService = new Mock <IAccountAppService>(); fakeAccountService.Setup(x => x.ResetPassword(fakeCommand)) .Returns(Task.FromResult(commandResponse)); var accountController = new AccountController(fakeAccountService.Object); var requestResult = await accountController.ResetPassword(fakeCommand); Assert.IsType <OkObjectResult>(requestResult); }
public async Task Reset_password_account_returns_bad_request() { var fakeCommand = new ResetPasswordAccount("*****@*****.**", "password", "code"); CommandResponse commandResponse = new ErrorCommandResponse(); commandResponse.AddNotification(null); var fakeAccountService = new Mock <IAccountAppService>(); fakeAccountService.Setup(x => x.ResetPassword(fakeCommand)) .Returns(Task.FromResult(commandResponse)); var accountController = new AccountController(fakeAccountService.Object); var requestResult = await accountController.ResetPassword(fakeCommand); Assert.IsType <BadRequestObjectResult>(requestResult); }
public async Task <CommandResponse> ResetPassword(ResetPasswordAccount command) { return(await _mediator.Send(command)); }