public void BreakWordIntoChar_ReturnCharList() { string word = "evil"; string listCheck = "big boy"; List <string> charList = new List <string> { "e", "v", "i", "l" }; AnagramGenerator newAnagramGenerator = new AnagramGenerator(word, listCheck); List <string> newList = new List <string> { }; newAnagramGenerator.CreateCharList(); newList = newAnagramGenerator.GetWordCharList(); CollectionAssert.AreEqual(charList, newList); }
public void CompareSplitLists_ReturnMatchingWords() { //Arrange string word = "bread"; List <string> sortedWord = new List <string> { "a", "b", "d", "e", "r" }; string unbrokenList = "banana mouse beard"; List <string> banana = new List <string> { "b", "a", "n", "a", "n", "a" }; List <string> mouse = new List <string> { "m", "o", "u", "s", "e" }; List <string> beard = new List <string> { "b", "e", "a", "r", "d" }; List <List <string> > listOfCharLists = new List <List <string> >() { banana, mouse, beard }; AnagramGenerator newAnagramGenerator = new AnagramGenerator(word, unbrokenList); List <List <string> > newListofLists = new List <List <string> > { }; newAnagramGenerator.SplitCompareList(); newAnagramGenerator.SplitCharacterCompareList(); newAnagramGenerator.SplitWordList(); //Act List <string> sortedWordChar = new List <string> { }; sortedWordChar = newAnagramGenerator.GetWordCharList(); sortedWordChar.Sort(); newAnagramGenerator.SortCompareList(); newAnagramGenerator.CompareSortedListToSortedWord(); newListofLists = newAnagramGenerator.GetResult(); //Assert for (int index = 0; index < newListofLists.Count; index++) { CollectionAssert.AreEqual(sortedWordChar, newListofLists[index]); } }
public void SplitWordIntoChar_ReturnCharList() { //Arrange string word = "bread"; string unbrokenList = "banana mouse"; List <string> charList = new List <string> { "b", "r", "e", "a", "d" }; AnagramGenerator newAnagramGenerator = new AnagramGenerator(word, unbrokenList); //Act List <string> newList = new List <string> { }; newAnagramGenerator.SplitWordList(); newList = newAnagramGenerator.GetWordCharList(); //Assert CollectionAssert.AreEqual(charList, newList); }