Пример #1
0
        //description: this is the method to test the reset function of one encryptWord object.
        //             The encryptWord object is defined in the below. It would display state and
        //             encryptResult before calling reset. Then it would displaying the same information
        //             after the reset. Thus, it shows how success the encryptWord class 's reset work.
        //precondition: none
        //postCondition: State would change from off to on after the method. EncryptResult will be different
        //               because of different shift number.
        public void testReset()
        {
            b = new encryptWord();
            b.setEncryptWord("verytired");
            String s = String.Format("{0,6} {1,15}{2,18}\n\n", "Original Word", "EncryptResult", "EncryptState");

            s += String.Format(" {0,6} {1,15} {2,18:NO}", b.getOriginal(), b.getResult(), b.checkState());
            Console.WriteLine(s);

            Console.WriteLine("\nAfter correctly guess the number: ");
            b.EncryptWordCheck(b.getRdm());
            Console.WriteLine("\n\nAfter reset:   ");
            b.reset();
            String d = String.Format("{0,6} {1,15}{2,18}\n\n", "Original Word", "EncryptResult", "EncryptState");

            d += String.Format(" {0,6} {1,15} {2,18:NO}", b.getOriginal(), b.getResult(), b.checkState());
            Console.WriteLine(d);
        }