Пример #1
0
        static void Test_Flip_Obj(Random rand, Flip flip_object)
        {
            uint flip_digit = (uint)rand.Next(0, RANDOM_FLIP_DIGIT_MAX);

            Console.WriteLine("Encapsulated password flipped before character #: " + flip_digit);
            Console.WriteLine("Flipped password: " + flip_object.Flip_Password(flip_digit));
            Console.WriteLine();
        }
Пример #2
0
        static Flip[] Initialize_Flip_Object_Array(Random rand, pwdCheck[] pwd_check_object_array, string[] password_array)
        {
            Console.WriteLine("Creating heterogeneous collection of Flip and FlipPwdCheck objects for testing...");
            Console.WriteLine();

            Flip[] initializer_array = new Flip[TEST_OBJ_ARRAY_SIZE];
            int    pwd_index;
            int    pwd_obj_array_index;

            for (uint i = 0; i < TEST_OBJ_ARRAY_SIZE; i++)
            {
                pwd_index = rand.Next(0, (int)SIZE_OF_PASSWORD_FILE);

                if (i < TEST_OBJ_ARRAY_SIZE / 2)
                {
                    Console.WriteLine("Object " + i + " encapsulated password is: " + password_array[pwd_index]);
                    initializer_array[i] = new Flip(password_array[pwd_index]);
                }
                else
                {
                    Console.WriteLine("Object " + i + " encapsulated password is: " + password_array[pwd_index]);
                    pwd_obj_array_index  = rand.Next(0, (int)TEST_OBJ_ARRAY_SIZE);
                    initializer_array[i] = new FlipPwdCheck(password_array[pwd_index], pwd_check_object_array[pwd_obj_array_index]);
                    if (pwd_check_object_array[pwd_obj_array_index] is compundC)
                    {
                        Console.WriteLine("Object type entered into the Flip object is of type: copmundC");
                    }
                    else if (pwd_check_object_array[pwd_obj_array_index] is excessC)
                    {
                        Console.WriteLine("Object type entered into the Flip object is of type: excessC");
                    }
                    else
                    {
                        Console.WriteLine("Object type entered into the Flip object is of type: pwdCheck");
                    }
                }
            }
            Console.WriteLine();
            Console.WriteLine(ASTERISK);
            Console.WriteLine("Press enter to continue program...");
            Console.WriteLine(ASTERISK);
            Console.ReadLine();
            return(initializer_array);
        }