public void PasswordManagementService_ValidateUser_ShouldCallUpdateEncryptionIfItIsSetAgainstTheUserAndItIsValidated() { var user = new User { CurrentEncryption = "SHA1" }; A.CallTo(() => _passwordEncryptionManager.ValidateUser(user, "password")).Returns(true); _passwordManagementService.ValidateUser(user, "password"); A.CallTo(() => _passwordEncryptionManager.UpdateEncryption(user, "password")).MustHaveHappened(); }
public bool ValidateUser(User user, string password) { var compareByteArrays = _passwordEncryptionManager.ValidateUser(user, password); if (compareByteArrays && !string.IsNullOrWhiteSpace(user.CurrentEncryption)) { _passwordEncryptionManager.UpdateEncryption(user, password); } return(compareByteArrays); }
public bool ValidateUser(User user, string password) { if (!string.IsNullOrWhiteSpace(user.Source) && _userSources.ContainsKey(user.Source)) { return(_userSources[user.Source].ValidateUser(user, password)); } var compareByteArrays = _passwordEncryptionManager.ValidateUser(user, password); if (compareByteArrays && !string.IsNullOrWhiteSpace(user.CurrentEncryption)) { _passwordEncryptionManager.UpdateEncryption(user, password); } return(compareByteArrays); }