private void buttonEncode_Click(object sender, EventArgs e)
        {
            var     selectedAlg = comboBoxAlgorithmus.SelectedIndex;
            ICrypto base64      = new Base64();
            ICrypto encrypter   = new Rijndael();
            ICrypto rot13       = new Rot13();

            if (entered == 1)
            {
                if (selectedAlg == 0)
                {
                    string encodedText = rot13.Encode(DecodedTextBox.Text);
                    CodedTextBox.Clear();
                    CodedTextBox.Text = encodedText;
                }
                if (selectedAlg == 1)
                {
                    string encodedText = base64.Encode(DecodedTextBox.Text);
                    CodedTextBox.Clear();
                    CodedTextBox.Text = encodedText;
                }
                if (selectedAlg == 2)
                {
                    string encodedText = encrypter.Encode(DecodedTextBox.Text);
                    CodedTextBox.Clear();
                    CodedTextBox.Text = encodedText;
                }
            }
            else
            {
                MessageBox.Show("Es ist kein Algorithmus ausgewählt", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 public void EncodeBasicTest()
 {
     TestObj.Encode("test").ShouldBe("grfg");
     TestObj.Encode("Test").ShouldBe("Grfg");
 }
Example #3
0
        public void test10plus2_is_twelve()
        {
            Rot13 encoder = new Rot13();

            Assert.AreEqual("10+2 is twelve.", encoder.Encode("10+2 vf gjryir."));
        }
Example #4
0
        public void TEST_To_GRFG()
        {
            Rot13 encoder = new Rot13();

            Assert.AreEqual("GRFG", encoder.Encode("TEST"));
        }
Example #5
0
        public void Test_To_Grfg()
        {
            Rot13 encoder = new Rot13();

            Assert.AreEqual("Grfg", encoder.Encode("Test"));
        }
Example #6
0
        public void test_To_grfg()
        {
            Rot13 encoder = new Rot13();

            Assert.AreEqual("grfg", encoder.Encode("test"));
        }
Example #7
0
 public void DoubleRot13GivesInputText()
 {
     Assert.AreEqual("aBcDeFg", _kata.Encode(_kata.Encode("aBcDeFg")));
 }