public async Task Changing_password_by_email_hashes_password_before_saving() { // Given A.CallTo(() => cryptoService.GetPasswordHash("new-password1")).Returns("hash-of-password"); // When await passwordService.ChangePasswordAsync("email", "new-password1"); // Then A.CallTo(() => cryptoService.GetPasswordHash("new-password1")).MustHaveHappened(1, Times.Exactly); ThenHasSetPasswordForEmailOnce("email", "hash-of-password"); }
public async Task ChangePasswordAsync() { const string password1 = "testing_1"; const string password2 = "testing_2"; ChangePasswordModel changePassword = new ChangePasswordModel { UserId = USER_ID, OldPassword = password1, NewPassword = password2 }; ResponseBase response = await PasswordService.ChangePasswordAsync(httpContext, changePassword).ConfigureAwait(false); Tests.ValidateResponse(response); changePassword.OldPassword = password2; changePassword.NewPassword = password1; response = await PasswordService.ChangePasswordAsync(httpContext, changePassword).ConfigureAwait(false); Tests.ValidateResponse(response); }