Esempio n. 1
0
        public void Does_correct_substitution(
            string alphabet,
            char keyChar,
            char expected,
            char inputChar
            )
        {
            var sut    = new AlphabetCipher(alphabet);
            var result = sut.Decode(inputChar, keyChar);

            Assert.Equal(expected, result);
        }
Esempio n. 2
0
        public void Should_decode_message_given_keyword()
        {
            // Arrange
            const string expected = "meetmebythetree";
            var          sut      = new AlphabetCipher("scones");

            // Act
            var actual = sut.Decode("egsgqwtahuiljgs");

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        static int Main(string[] args)
        {
            if (args.Count() < 2)
            {
                Console.WriteLine("Usage: decode key input");
                return(1);
            }

            var key    = args[0].ToLower();
            var input  = args[1].ToLower();
            var cipher = new AlphabetCipher();

            Console.WriteLine(cipher.Decode(input, key));

            return(0);
        }