Esempio n. 1
0
        public void AnagramSearchConstructor_CreatesNewInstanceOfAnagramSearch_AnagramSearch()
        {
            string        expectedWord        = "ant";
            List <string> expectedListOfWords = new List <string> {
                "ant"
            };
            AnagramSearch newAnagramSearch = new AnagramSearch(expectedWord, expectedListOfWords);

            Assert.AreEqual(typeof(AnagramSearch), newAnagramSearch.GetType());
        }
Esempio n. 2
0
        public void GetGivenListOfWords_ReturnsTheValueOfAnagramSearchPropertyGivenListOfWords_ListOfStrings()
        {
            string        expectedWord        = "ant";
            List <string> expectedListOfWords = new List <string> {
                "ant"
            };
            AnagramSearch newAnagramSearch = new AnagramSearch(expectedWord, expectedListOfWords);

            List <string> actualListOfWords = newAnagramSearch.GetGivenListOfWords();

            Assert.AreEqual(expectedListOfWords, actualListOfWords);
        }
Esempio n. 3
0
        public void GetGivenWord_ReturnsTheValueOfAnagramSearchPropertyGivenWord_String()
        {
            string        expectedWord        = "ant";
            List <string> expectedListOfWords = new List <string> {
                "ant"
            };
            AnagramSearch newAnagramSearch = new AnagramSearch(expectedWord, expectedListOfWords);

            string actualWord = newAnagramSearch.GetGivenWord();

            Assert.AreEqual(expectedWord, actualWord);
        }
Esempio n. 4
0
        public void DoesListContainAnagramsOfWord_ReturnsListOfWordsThatAreAnagramsOfTheWord_ListOfStrings()
        {
            string        wordToSearchFor             = "ant";
            List <string> expectedListOfMatchingWords = new List <string> {
                "tan"
            };
            List <string> listOfWordsToSearch = new List <string> {
                "tan"
            };

            AnagramSearch newAnagramSearch = new AnagramSearch(wordToSearchFor, listOfWordsToSearch);

            List <string> listOfMatchingWordsFound = newAnagramSearch.DoesListContainAnagramsOfWord();

            CollectionAssert.AreEqual(expectedListOfMatchingWords, listOfMatchingWordsFound);
        }
Esempio n. 5
0
        public void DoesListContainAnagramsOfWord_ReturnsListOfWordsThatMatchTheWordExactly_ListOfStrings()
        {
            string        wordToSearchFor             = "ant";
            List <string> expectedListOfMatchingWords = new List <string> {
                "ant", "ant"
            };
            List <string> listOfWordsToSearch = new List <string> {
                "cat", "dog", "ant", "fish", "turtle", "ant"
            };

            AnagramSearch newAnagramSearch = new AnagramSearch(wordToSearchFor, listOfWordsToSearch);

            List <string> listOfMatchingWordsFound = newAnagramSearch.DoesListContainAnagramsOfWord();

            CollectionAssert.AreEqual(expectedListOfMatchingWords, listOfMatchingWordsFound);
        }