public void TestN() { MorseKeyTable mkt = new MorseKeyTable(); Assert.AreEqual("-.", mkt.GetMorse("N")); Assert.AreEqual("N", mkt.GetAlpha("-.")); }
public void TestI() { MorseKeyTable mkt = new MorseKeyTable(); Assert.AreEqual("..", mkt.GetMorse("I")); Assert.AreEqual("I", mkt.GetAlpha("..")); }
public void TestT() { MorseKeyTable mkt = new MorseKeyTable(); Assert.AreEqual("-", mkt.GetMorse("T")); Assert.AreEqual("T", mkt.GetAlpha("-")); }
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()); }