コード例 #1
0
        public void FindWordsWhenMatchTheUnexistingLetters()
        {
            var wordList = new List <string>()
            {
                "AAAA", "AAAB", "ABAA"
            };
            var wf = new WordsFinder(wordList);

            var letterA = new Letter();

            letterA.Solve('A');

            var letterMinusB = new Letter();

            letterMinusB.DiscardPossibility('B');

            var word = new Word(new List <Letter>()
            {
                letterA,
                letterA,
                letterA,
                letterMinusB
            });

            var wordsSolutions = wf.GetWords(word);

            Assert.AreEqual(1, wordsSolutions.Count);
        }
コード例 #2
0
        public void FindWordsWhenMatchTheExistingLetters()
        {
            var wordList = new List <string>()
            {
                "AAAA", "AAAB", "ABAA"
            };
            var wf = new WordsFinder(wordList);

            var letterA = new Letter();

            letterA.Solve('A');

            var letter = new Letter();


            var word = new Word(new List <Letter>()
            {
                letterA,
                letterA,
                letterA,
                letter
            });

            var wordsSolutions = wf.GetWords(word);

            Assert.AreEqual(2, wordsSolutions.Count);
        }
コード例 #3
0
        public void ReturnEmptyStringListWhenNoWordIsFound()
        {
            var wf = new WordsFinder();

            var words = wf.GetWords("");

            Assert.AreEqual(0, words.Count);
        }
コード例 #4
0
        public void ReturnOneWordWhenItMatchesTheFilter()
        {
            var wordList = new List <string>()
            {
                "word", "hello"
            };
            var wf = new WordsFinder(wordList);

            var wordsSolutions = wf.GetWords("hello");

            Assert.AreEqual(1, wordsSolutions.Count);
        }
コード例 #5
0
        public void ReturnOneWordWhenThereIsOneWordInDictionaryAndEmptyFilter()
        {
            var wordList = new List <string>()
            {
                "word"
            };
            var wf = new WordsFinder(wordList);

            var words = wf.GetWords("");

            Assert.AreEqual(1, words.Count);
        }
コード例 #6
0
        public void FindTwoWordsOfFourCharacters()
        {
            var wordList = new List <string>()
            {
                "WORD", "HELLO", "ABCD"
            };
            var wf = new WordsFinder(wordList);

            var letter = new Letter();
            var word   = new Word(new List <Letter>()
            {
                letter,
                letter,
                letter,
                letter
            });

            var wordsSolutions = wf.GetWords(word);

            Assert.AreEqual(2, wordsSolutions.Count);
        }