public void TestValidatePassport(int iTestDataPassport, bool expectedValid)
        {
            string[] rawPassports = PassportValidator.GetInputData(FilePathTestData);
            Dictionary <string, string> parsedPassport = PassportValidator.ParseRawPassport(rawPassports[iTestDataPassport]);
            bool passportValid = PassportValidator.ValidatePassport(parsedPassport);

            Assert.AreEqual(expectedValid, passportValid);
        }
Exemple #2
0
        public static int CountValidPassports(string[] rawPassports)
        {
            int noOfValidPasswords = 0;

            foreach (string rawPassport in rawPassports)
            {
                Dictionary <string, string> parsedPassport = PassportValidator.ParseRawPassport(rawPassport);
                if (PassportValidator.ValidatePassport(parsedPassport))
                {
                    noOfValidPasswords++;
                }
            }

            return(noOfValidPasswords);
        }
Exemple #3
0
        public static bool ValidatePassportStrict(Dictionary <string, string> parsedPassport)
        {
            bool passportIsValid = true;

            // First test with the simple Validator
            if (!PassportValidator.ValidatePassport(parsedPassport))
            {
                passportIsValid = false;
            }

            // Second, invalidate by Regex
            else if (!PassportValidator.ValidatePassportRegex(parsedPassport))
            {
                passportIsValid = false;
            }

            return(passportIsValid);
        }