예제 #1
0
        public void GetList_ReturnsWords_StringList()
        {
            string word1 = "dear";
            string word2 = "pier";

            Anagram.Add(word1);
            Anagram.Add(word2);
            List <string> wordList = new List <string> {
                word1, word2
            };

            List <string> result = Anagram.GetList();

            CollectionAssert.AreEqual(wordList, result);
        }
예제 #2
0
        public void GetAnagrams_ReturnsPartialMatches_ListString()
        {
            string        word    = "hat";
            List <string> matches = new List <string> {
                "path"
            };
            Anagram anagram = new Anagram(word);

            Anagram.Add("path");
            Anagram.Add("Pan");
            Anagram.Add("Bottle");

            List <string> result = Anagram.GetAnagrams();

            CollectionAssert.AreEqual(matches, result);
        }
예제 #3
0
        public void SortList_SortsList_ListString()
        {
            string        word1       = "dear";
            string        word2       = "pier";
            string        sortedWord1 = "ader";
            string        sortedWord2 = "eipr";
            List <string> sortedList  = new List <string> {
                sortedWord1, sortedWord2
            };

            Anagram.Add(word1);
            Anagram.Add(word2);

            Anagram.SortList();
            List <string> result = Anagram.GetSortedList();

            CollectionAssert.AreEqual(sortedList, result);
        }
예제 #4
0
        public void GetAnagrams_ReturnsMatchingWords_ListString()
        {
            string        word    = "east";
            List <string> matches = new List <string> {
                "seat", "eats"
            };
            Anagram anagram = new Anagram(word);

            Anagram.Add("dear");
            Anagram.Add("seat");
            Anagram.Add("pier");
            Anagram.Add("eats");
            Anagram.Add("sand");

            List <string> result = Anagram.GetAnagrams();

            CollectionAssert.AreEqual(matches, result);
        }