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); }
//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); } }
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); }