Example #1
0
        public void TestN()
        {
            MorseKeyTable mkt = new MorseKeyTable();

            Assert.AreEqual("-.", mkt.GetMorse("N"));
            Assert.AreEqual("N", mkt.GetAlpha("-."));
        }
Example #2
0
        public void TestI()
        {
            MorseKeyTable mkt = new MorseKeyTable();

            Assert.AreEqual("..", mkt.GetMorse("I"));
            Assert.AreEqual("I", mkt.GetAlpha(".."));
        }
Example #3
0
        public void TestT()
        {
            MorseKeyTable mkt = new MorseKeyTable();

            Assert.AreEqual("-", mkt.GetMorse("T"));
            Assert.AreEqual("T", mkt.GetAlpha("-"));
        }
Example #4
0
        public string AlphaToMorse(string line)
        {
            string morseLine = "";

            string [] words = line.Split(new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string word in words)
            {
                foreach (char alpha in word)
                {
                    morseLine += mkt.GetMorse(alpha.ToString());
                    morseLine += " ";
                }
                morseLine += "      ";
            }

            return(morseLine.Trim());
        }