public async Task <PasswordTestResult> TestPassword(string username, string password)
        {
            try
            {
                UserPrincipal up = await WindowsSamController.GetUserPrincipal(username);

                PasswordTestResultCode result = (PasswordTestResultCode)(int)FilterInterface.TestPassword(up.SamAccountName, up.DisplayName, password, false);
                if (result != PasswordTestResultCode.Approved)
                {
                    Logger.Warn($"User {username} attempted to set a password that was rejected by Lithnet Password Protection with the following code: {result}");
                }

                return(new PasswordTestResult(result));
            }
            catch (NotFoundException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "An unexpected error occurred checking the password against the Lithnet Password Protection service");

                if (PasswordChangeConfigSection.Configuration.PasswordTesting.LppIgnoreErrors)
                {
                    return(new PasswordTestResult());
                }
                else
                {
                    return(new PasswordTestResult(PasswordTestResultCode.GeneralError));
                }
            }
        }
 /// <summary>
 /// Create a new test result for a given result code and optional descriptive message
 /// </summary>
 /// <param name="code">Password test error code</param>
 public PasswordTestResult(PasswordTestResultCode code, params object[] args)
 {
     this.Code      = code;
     this.Arguments = args;
 }