public void Security_Cryptography_CaesarEncryptor() { var TestItem = new CaesarEncryptor(); var encryptedString = TestItem.Encrypt("Test"); Assert.IsTrue(encryptedString == "bQB%2BAIwAjQA%3D"); var decryptedString = TestItem.Decrypt(encryptedString); Assert.IsTrue(decryptedString == "Test"); }
private void Encrypt(string alph, int shift) { ExpandForm(NormalFormHeight); string text = inputText.Text; var encryptor = new CaesarEncryptor(alph, shift); try { resultEncText.Text = encryptor.Encrypt(text); resultDecText.Text = encryptor.Decrypt(resultEncText.Text); } catch (KeyNotFoundException) { MessageBox.Show( Resources.MainForm_Encrypt_Some_letters_aren_t_from_the_current_alphabet, Resources.MainForm_Encrypt_Wrong_text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }