Example #1
0
        public void Setup()
        {
            ISet <string> dictionary = MorseDecoderTests.GetDefaultDictionary();

            this.decoder = new MorseDecoder()
            {
                MorseSequence      = "--.----.......-.---.--......-..",
                FirstLetters       = MorseDecoderTests.GetFirstLetters(dictionary),
                WordsByFirstLetter = MorseDecoderTests.GetWordsByFirstLetter(dictionary)
            };
        }
Example #2
0
        public async Task TestGodIsNowHere()
        {
            string morse = "--.----.......-.---.--......-..";

            IEnumerable <string> solution = await this.decoder.DecodeAndReturnMessagesAsync(morse, MorseDecoderTests.GetDefaultDictionary());

            Assert.AreEqual(6, solution.Count());
            Assert.IsTrue(solution.Contains("GOD E E E E E NOW HERE"));
            Assert.IsTrue(solution.Contains("GOD E E E E E NOW HER E"));
            Assert.IsTrue(solution.Contains("GOD E E E E E NO WHERE"));
            Assert.IsTrue(solution.Contains("GOD IS NOW HERE"));
            Assert.IsTrue(solution.Contains("GOD IS NOW HER E"));
            Assert.IsTrue(solution.Contains("GOD IS NO WHERE"));
        }