Ejemplo n.º 1
0
        public void DecodeMethod_DecodeSpecialServiceCode_SOS()
        {
            string    inputstring = "···−−−···";
            string    expected    = "SOS";
            MorseUtil morseUtil   = new MorseUtil();
            string    actual      = morseUtil.Decode(inputstring);

            Assert.AreEqual(expected, actual, "Unable to decode '{0}' special service code", inputstring);
        }
Ejemplo n.º 2
0
        public void DecodeMethod_DecodePhrase()
        {
            string    inputstring = ".... . -.--   .--- ..- -.. .";
            string    expected    = "HEY JUDE";
            MorseUtil morseUtil   = new MorseUtil();
            string    actual      = morseUtil.Decode(inputstring);

            Assert.AreEqual(expected, actual, "Unable to decode '{0}' phrase", inputstring);
        }
Ejemplo n.º 3
0
        public void DecodeMethod_DecodeCharacter()
        {
            string    inputstring = ".";
            string    expected    = "E";
            MorseUtil morseUtil   = new MorseUtil();
            string    actual      = morseUtil.Decode(inputstring);

            Assert.AreEqual(expected, actual, "Unable to decode '{0}' char", inputstring);
        }
Ejemplo n.º 4
0
        public void DecodeMethod_DecodeWord()
        {
            string    inputstring = ".... . -.--";
            string    expected    = "HEY";
            MorseUtil morseUtil   = new MorseUtil();
            string    actual      = morseUtil.Decode(inputstring);

            Assert.AreEqual(expected, actual, "Unable to decode '{0}' word", inputstring);
        }
Ejemplo n.º 5
0
        public void DecodeMethod_PassEmptyString_ReturnEmptyString()
        {
            string    inputstring = string.Empty;
            string    expected    = string.Empty;
            MorseUtil morseUtil   = new MorseUtil();
            string    actual      = "notempty";

            try
            {
                actual = morseUtil.Decode(inputstring);
                Assert.AreEqual(expected, actual, "String returned isn't empty");
            }
            catch (Exception e)
            {
                Assert.AreEqual(expected, actual, e.Message);
            }
        }