Exemplo n.º 1
0
        public void InsertsDoubleWordNotFound(string word)
        {
            List <string> inputDictionary = new List <string>()
            {
                "spain", "plaint", "paint"
            };

            _dictionaryLogic  = new DictionaryLogic(inputDictionary, _alphabetUS);
            _correctionsLogic = new CorrectionsLogic(_dictionaryLogic, _formatStrings);

            string testString = _correctionsLogic.Correct(word);

            Assert.That(testString, Is.EqualTo("{" + word + "?}"));
        }
Exemplo n.º 2
0
        public void ReturnAnUnknownWord(string wordUnknown)
        {
            List <string> inputDictionary = new List <string>()
            {
                "rain", "spain", "plain", "plaint", "pain", "main", "mainly", "the", "in", "on", "fall", "falls", "his", "was"
            };

            _dictionaryLogic  = new DictionaryLogic(inputDictionary, _alphabetUS);
            _correctionsLogic = new CorrectionsLogic(_dictionaryLogic, _formatStrings);

            string testString = _correctionsLogic.Correct(wordUnknown);

            Assert.AreEqual("{" + wordUnknown + "?}", testString);
        }
Exemplo n.º 3
0
        public void ReturnAnSomeWords()
        {
            List <string> inputDictionary = new List <string>()
            {
                "spain", "plaint", "paint"
            };
            string word = "ptain";

            _dictionaryLogic  = new DictionaryLogic(inputDictionary, _alphabetUS);
            _correctionsLogic = new CorrectionsLogic(_dictionaryLogic, _formatStrings);

            string testString = _correctionsLogic.Correct(word);

            Assert.AreEqual("{spain paint}", testString);
        }
Exemplo n.º 4
0
        public void OutputTrueString()
        {
            List <string> inputDictionary = new List <string>()
            {
                "rain", "spain", "plain", "plaint", "pain", "main", "mainly", "the", "in", "on", "fall", "falls", "his", "was"
            };
            List <string> wordsArrayList = new List <string>()
            {
                "hte", "rame", "in", "pain", "fells", "mainy", "oon", "teh", "lain", "was", "hints", "pliant"
            };

            _dictionaryLogic  = new DictionaryLogic(inputDictionary, _alphabetUS);
            _correctionsLogic = new CorrectionsLogic(_dictionaryLogic, _formatStrings);

            string output = "";

            foreach (string s in wordsArrayList)
            {
                output += _correctionsLogic.Correct(s) + " ";
            }

            Assert.That(output.Trim(' '), Is.EqualTo("the {rame?} in pain falls {main mainly} on the plain was {hints?} plaint"));
        }