public void AnagramCheckerTest_OneWord_True() { string testWord = "bread"; string testWordList = "beard"; AnagramChecker testAnagramChecker = new AnagramChecker(testWord, testWordList); List <string> results = testAnagramChecker.Check(); string sortedTestWord = AnagramChecker.SortWord(testWord); string sortedPossibleAnagram = AnagramChecker.SortWord(results[0]); Assert.Equal(true, sortedPossibleAnagram == sortedTestWord); }
public HomeModule() { Get["/"] = _ => { //List<string> anagramList = new List<string>(); return(View["index.cshtml"]); }; Post["/anagram"] = _ => { AnagramChecker newAnagram = new AnagramChecker(Request.Form["user-word"], Request.Form["user-anagrams"]); var anagramList = newAnagram.Check(); return(View["anagram.cshtml", anagramList]); }; }
public void AnagramCheckerTest_WillReturnNonAnagrams_False() { bool goodData = true; string testWord = "bread"; string testWordList = "beard,bared,kite,flyer"; AnagramChecker testAnagramChecker = new AnagramChecker(testWord, testWordList); List <string> results = testAnagramChecker.Check(); string sortedTestWord = AnagramChecker.SortWord(testWord); foreach (string possibleAnagram in results) { Console.WriteLine(possibleAnagram); string sortedPossibleAnagram = AnagramChecker.SortWord(possibleAnagram); if (sortedPossibleAnagram != sortedTestWord) { goodData = false; } } Assert.Equal(true, goodData); }