Beispiel #1
0
        public void canMorseAnCipherDirectly()
        {
            var cipherMorse = new CipherMorse(new AmericanMorse());

            string message     = "DAVID";
            string morseCipher = cipherMorse.MorseCipher(message);
            string original    = cipherMorse.UnMorseCipher(morseCipher);

            Assert.AreEqual(message, original);
        }
Beispiel #2
0
        //for getting cipher method
        public static CipherBase GetCipher(int methodSelection)
        {
            switch (methodSelection)
            {
            case 1: return(CipherMorse.Create());

            case 2: return(CipherCaesar.Create(Options.KeyValue > 0 ? Options.KeyValue : 1));

            default: return(null);
            }
        }
Beispiel #3
0
        public void canChipherAndMorse()
        {
            var cipherMorse = new CipherMorse(new AmericanMorse());

            string message  = "DAVID";
            string morse    = cipherMorse.Morse(message);
            string cipher   = cipherMorse.Cipher(morse);
            string original = cipherMorse.UnMorse(cipherMorse.Decrypt(cipher));

            Assert.AreEqual(message, original);
        }