Пример #1
0
        public void Vigenere_CipherTest()
        {
            Cipher cipher = new Vigenere_Cipher("hello you", "dog");

            Assert.IsNotNull(cipher);
            cipher = null;
            Assert.IsNull(cipher);
        }
Пример #2
0
        public void EncryptTest()
        {
            // Testing Vigenere Cipher
            string actual   = "ksroc eri";
            Cipher cipher   = new Vigenere_Cipher("hello you", "dog");
            string expected = cipher.Encrypt();

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void DecryptTest()
        {
            // Testing Vigenere Cipher
            string expected = "hello you";
            Cipher cipher   = new Vigenere_Cipher("ksroc eri", "dog");
            string result   = cipher.Decrypt();

            Assert.AreEqual(expected, result);
        }
Пример #4
0
        public void cipher_test3()
        {
            Cesar_Cipher    c  = new Cesar_Cipher(7);
            Vigenere_Cipher v2 = new Vigenere_Cipher("mno");
            Atbash_Cipher   a2 = new Atbash_Cipher();

            string t = "Booble gum";

            Assert.IsTrue(t == c.decrypt(c.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            Assert.IsTrue(t == a2.decrypt(a2.encrypt(t)));
            t = "cat dog";
            Assert.IsTrue(t == c.decrypt(c.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "The sun";
            Assert.IsTrue(t == c.decrypt(c.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "just test it";
            Assert.IsTrue(t == c.decrypt(c.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
        }
Пример #5
0
        public void cipher_test2()
        {
            Cesar_Cipher    c2 = new Cesar_Cipher(5);
            Vigenere_Cipher v2 = new Vigenere_Cipher("xyz");
            Atbash_Cipher   a2 = new Atbash_Cipher();

            string t = "Hi bob";

            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            Assert.IsTrue(t == a2.decrypt(a2.encrypt(t)));
            t = "Not yet";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "The American Dream is a national ethos of the United States";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "just test it";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
        }
Пример #6
0
        public void cipher_test1()
        {
            /*Cesar_Cipher ces = new Cesar_Cipher(3);
             * Vigenere_Cipher v=new Vigenere_Cipher("abc");
             * Atbash_Cipher at=new Atbash_Cipher(5);*/
            Cesar_Cipher    c1 = new Cesar_Cipher(10);
            Vigenere_Cipher v1 = new Vigenere_Cipher("gfgf");
            Atbash_Cipher   a  = new Atbash_Cipher();

            string t = "Hi bob";

            Assert.IsTrue(t == c1.decrypt(c1.encrypt(t)));
            Assert.IsTrue(t == v1.decrypt(v1.encrypt(t)));
            Assert.IsTrue(t == a.decrypt(a.encrypt(t)));
            t = "Not yet";
            Assert.IsTrue(t == c1.decrypt(c1.encrypt(t)));
            Assert.IsTrue(t == v1.decrypt(v1.encrypt(t)));
            t = "The American Dream is a national ethos of the United States";
            Assert.IsTrue(t == c1.decrypt(c1.encrypt(t)));
            Assert.IsTrue(t == v1.decrypt(v1.encrypt(t)));
            t = "just test it";
            Assert.IsTrue(t == c1.decrypt(c1.encrypt(t)));
            Assert.IsTrue(t == v1.decrypt(v1.encrypt(t)));
        }
Пример #7
0
        public void Is_Key_ValidTest()
        {
            Cipher cipher = new Vigenere_Cipher("Hello World", "13");

            Assert.IsFalse(cipher.Is_Key_Valid());
        }