public void Checkpassword8CharsLong()
        {
            string validPassword   = "******";
            string invalidPassword = "******";

            PasswordChecker checker = new PasswordChecker();

            Assert.IsTrue(checker.CheckPassword(validPassword));
            Assert.IsFalse(checker.CheckPassword(invalidPassword));
        }
        public void TestPasswordCompareNoMatch()
        {
            var checker = new PasswordChecker(new Mock <IConsole>().Object);
            var result  = checker.CheckPassword(P1, P2, out _);

            Assert.False(result);
        }
    public void CheckPassword_PasswordLessThanEightCharacters_ReturnsFalse()
    {
        string          invalidPassword = "******";
        PasswordChecker checker         = new PasswordChecker();

        Assert.IsFalse(checker.CheckPassword(invalidPassword));
    }
        public void TestPasswordTooShortValidation()
        {
            var checker = new PasswordChecker(new Mock <IConsole>().Object);
            var isValid = checker.CheckPassword("short", "short", out _);

            Assert.False(isValid);
        }
    public void CheckPassword_PasswordLongerThanSevenCharacters_ReturnsTrue()
    {
        string          validPassword = "******";
        PasswordChecker checker       = new PasswordChecker();

        Assert.IsTrue(checker.CheckPassword(validPassword));
    }
Esempio n. 6
0
    /// <summary>
    /// Завершить ввод и проверить пароль
    /// </summary>
    private void CompletePasswordEntry()
    {
        bool correct = passwordChecker.CheckPassword(enteredPassword);

        enteredPassword.Clear();

        wrongPasswordPopup.SetActive(!correct);
        rightPasswordPopup.SetActive(correct);
    }
Esempio n. 7
0
        public void CheckPassword_PasswordIsEntered_ShouldReturnTrueIfAllChecksPass(string expected, string password)
        {
            // Arrange
            // Act
            string actual = PasswordChecker.CheckPassword(password);

            // Assert
            Assert.Equal(expected, actual);
        }
        public void TestPasswordValidation()
        {
            var checker = new PasswordChecker(new Mock <IConsole>().Object);
            var isValid = checker.CheckPassword(P2, P2, out var myPassword);

            Assert.True(isValid);
            Assert.Equal("gfHBWzLIsM3JeoVSJtVflw==", myPassword);

            isValid = checker.ComparePassword("rtHjiKmfreDswVV", "SeffhdfuiDfrgrg");
            Assert.False(isValid);
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            /**
             * Password Checker
             * tells if you have created a valid password or not
             */
            var isUserInSession = true;

            while (isUserInSession)
            {
                Console.WriteLine("Welcome To Password Checker v.1 ");
                Console.WriteLine(" your number one tool for checking password integrity and strength");
                Console.Write(" Type In a Password: "******"Please Enter a Valid Input! Enter E to exit");
                    string nextInput = Console.ReadLine();
                    if (!String.IsNullOrEmpty(nextInput) && nextInput.ToLower() == "e")
                    {
                        isUserInSession = false;
                    }
                }
                else
                {
                    Console.WriteLine("Pasword Recorded. Now Evaluating...");
                    if (userInput.Length < 8)
                    {
                        string message = "Error: ";

                        Console.WriteLine(message + " Password Must be 8 characters or Longer!!");
                        isUserInSession = false;
                    }
                    else
                    {
                        var Response = PasswordChecker.CheckPassword(userInput);
                        if (!Response.passwordContainsLowerCase || !Response.passwordContainsNumber || !Response.passwordContainsUpperCase)
                        {
                            Console.WriteLine("Evaluation Complete");
                            Console.WriteLine("All error messages:  *" + Response.GetErrorMessages()[0] + ", * " + Response.GetErrorMessages()[1] + ",  *" + Response.GetErrorMessages()[2]);
                            isUserInSession = false;
                        }
                        else
                        {
                            Console.WriteLine("Evaluation Complete");
                            Console.WriteLine(Response.GetSuccessMessage());
                            isUserInSession = false;
                        }
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the correct passwort (Hint: It rhymes with \'best\'!");
            string userPW = "";

            string          secretPW = "test";
            PasswordChecker checker  = new PasswordChecker(secretPW);

            checker.SubmittedCorredPassphrase += c_CorrectPW;

            while (userPW != secretPW)
            {
                userPW = Console.ReadLine();
                checker.CheckPassword(userPW);
            }
        }
Esempio n. 11
0
        public void Initialize()
        {
            IList <string> inputRange = FileUtil.ReadAllLines("day_4_password_range.txt");
            IList <int>    inputs     = IntegerUtil.ParseInts(inputRange[0]);
            int            lowerBound = inputs[0];
            int            upperBound = inputs[1];

            int validPasswords = 0;

            for (int i = lowerBound; i <= upperBound; i++)
            {
                if (passwordChecker.CheckPassword(i))
                {
                    validPasswords++;
                }
            }

            outputWriter.WriteLine($"{validPasswords}");
        }
Esempio n. 12
0
        public bool ValidateUser(string username, string password, int apiEwId = 0)
        {
            var   isValid = false;
            ApiEw apiEw   = null;
            EarthwatcherRepository earthwatcherRepo = new EarthwatcherRepository(connectionString);

            if (apiEwId != 0)
            {
                apiEw = earthwatcherRepo.GetApiEwById(apiEwId);
            }
            if (apiEw == null)
            {
                var credentials = CredentialsRepository.GetCredentials(connectionString, username);
                isValid = PasswordChecker.CheckPassword(password, credentials.Prefix, credentials.Hash);
            }
            else
            {
                //TODO: Validacion de AccessToken, por ahora si entro con una api lo manda derecho
                isValid = true;
            }
            return(isValid);
        }
Esempio n. 13
0
 public bool CheckPassword_ValidInput_ReturnsTrue(int number)
 {
     return(cut.CheckPassword(number));
 }
Esempio n. 14
0
 public void CheckPassword_TooLong_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("asdfasdfasdfasdfasdfasdf"));
 }
Esempio n. 15
0
 public void CheckPassword_GoodPassword_ReturnsTrue()
 {
     Assert.IsTrue(PasswordChecker.CheckPassword("aBcdef12&"));
 }
Esempio n. 16
0
 public void CheckPassword_NoSpecialCharacters_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("aASaASDF"));
 }
Esempio n. 17
0
 public void CheckPassword_ContainsWhiteSpace_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("as aasdf"));
 }
Esempio n. 18
0
 public void CheckPassword_NoUpperCase_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("asdfasdf"));
 }
Esempio n. 19
0
 public void CheckPassword_NoLowerCase_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("ASDFASDF"));
 }
Esempio n. 20
0
 public void CheckPassword_SameConsecutive_ReturnsFalse()
 {
     Assert.IsFalse(PasswordChecker.CheckPassword("AASaASDF"));
 }