public async Task ValidPassword_ReturnsSuccess() { var helper = new FakeUserHelper1(); var result = await helper.SetPasswordHash( new User(), new Password("ValidPassword")); Assert.True(result.Success); }
public async Task NullPassword_Throws() { UserHelper helper = new FakeUserHelper1(); await Assert.ThrowsAsync <ArgumentNullException>("password", async() => { await helper.SetPasswordHash( user: new User(), password: null); }); }
public async Task NullUser_Throws() { UserHelper helper = new FakeUserHelper1(); await Assert.ThrowsAsync <ArgumentNullException>("user", async() => { await helper.SetPasswordHash <User>( user: null, password: new Password("ValidPassword")); }); }
public async Task InvalidPasswordStrength_ReturnsFailure() { var helper = new FakeUserHelper1(); var result = await helper.SetPasswordHash(new User(), new Password("1234567")); Assert.False(result.Success); Assert.Equal( new FakeMinimumLengthPasswordStrengthValidator().InvalidPasswordStrength.Message, result.Failure.Message); }
public async Task ValidPassword_CallsPasswordHasher() { var helper = new FakeUserHelper1(); var password = new Password("password"); var user = new User(); var result = await helper.SetPasswordHash(user, password); Assert.Equal(password, helper.FakePasswordHasher.Hash_InputPassword); Assert.Equal(helper.FakePasswordHasher.Hash_Output, user.PasswordHash); }