Exemplo n.º 1
0
        public static bool TestTo7(string accountNumber, int index)
        {
            string falseAccountNumber = accountNumber;

            falseAccountNumber = falseAccountNumber.Remove(index, 1).Insert(index, "7").Remove(9);

            return(NumberFinder.CheckIfAccountIsValid(falseAccountNumber));
        }
Exemplo n.º 2
0
        public static bool TestTo9(string accountNumber, int index)
        {
            string falseAccountNumber = accountNumber;

            falseAccountNumber = falseAccountNumber.Remove(index, 1).Insert(index, "9");
            if (falseAccountNumber.Length > 9)
            {
                falseAccountNumber = falseAccountNumber.Remove(9);
            }

            return(NumberFinder.CheckIfAccountIsValid(falseAccountNumber));
        }
Exemplo n.º 3
0
        public static bool TestTheTwoCasesOf9(string accountNumber, int index)
        {
            bool   isPossible9        = false;
            string falseAccountNumber = accountNumber;

            falseAccountNumber = falseAccountNumber.Remove(index, 1).Insert(index, "5").Remove(9);

            isPossible9 = NumberFinder.CheckIfAccountIsValid(falseAccountNumber);
            if (!isPossible9)
            {
                isPossible9 = TestTo8(falseAccountNumber, index);
            }
            return(isPossible9);
        }
Exemplo n.º 4
0
        public static bool TestAllNumbers(string accountNumber, int index)
        {
            bool   isPossible         = false;
            string falseAccountNumber = accountNumber.Remove(9);

            for (int j = 0; j < 10; j++)
            {
                falseAccountNumber = falseAccountNumber.Remove(index, 1).Insert(index, j.ToString());
                isPossible         = NumberFinder.CheckIfAccountIsValid(falseAccountNumber);
                if (isPossible)
                {
                    return(true);
                }
            }

            return(false);
        }