Ejemplo n.º 1
0
        public static void WhenGivenNoMessageReturnAnEmptyString()
        {
            ICodeReader reader   = IoC.Container.GetService <ICodeReader>();
            var         expected = "";
            var         actual   = reader.DecryptMessage("");

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public static void WhenGivenSomeValidMorseCodeReturnTheMessage()
        {
            ICodeReader reader   = IoC.Container.GetService <ICodeReader>();
            string      input    = ".... . -.--   .--- ..- -.. .";
            string      expected = "HEY JUDE";

            var actual = reader.DecryptMessage(input);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your morse code and press enter.");
            var         input  = Console.ReadLine();
            ICodeReader reader = IoC.Container.GetService <ICodeReader>();
            var         output = "";

            try
            {
                output = reader.DecryptMessage(input);
                Console.WriteLine($"That translates to: {output}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Something went wrong... {ex.ToString()}");
            }
            Console.ReadKey();
        }