public void Should_Not_Return_Anagrams_Shorter_Then_Specified_By_Config(string userInput) { AnagramSolver anagramSolver = new AnagramSolver(config); List <WordModel> anagrams = anagramSolver.GetAnagrams(userInput, wordsRepository.GetWords()); Assert.IsTrue(anagrams.All(anagram => anagram.word.Length > config.Value.minWordLength)); }
static void Main(string[] args) { string userInputString = ""; foreach (string word in args) { userInputString += word; } int minWordLength = Int32.Parse(ConfigurationManager.AppSettings["minWordLength"]); int maxResultsLenth = Int32.Parse(ConfigurationManager.AppSettings["maxResultsLenth"]); AnagramConfiguration anagramConfiguration = new AnagramConfiguration(minWordLength, maxResultsLenth); IWordsRepository wordsRepository = new WordsRepository(); IAnagramSolver anagramSolver = new AnagramSolver(wordsRepository, anagramConfiguration); List <string> anagrams = anagramSolver.GetAnagrams(userInputString); foreach (string anagram in anagrams) { Console.WriteLine(anagram); } Thread.Sleep(2000); }
public void Should_Return_Two_Anagrams(string userInput) { AnagramSolver anagramSolver = new AnagramSolver(config); List <WordModel> anagrams = anagramSolver.GetAnagrams(userInput, wordsRepository.GetWords()); Assert.IsTrue(anagrams.Count() == 2); }
public void DoNotReturnTestWordAsAnagram() { AnagramSolver Solver = new AnagramSolver(Path); string word = Config["testWord3"]; IList <string> anagrams = Solver.GetAnagrams(word); Assert.IsFalse(anagrams.Contains(word)); }
public void ReturnNullIfNoWordsWhereFound() { AnagramSolver Solver = new AnagramSolver(Path); string word = Config["testWord2"]; IList <string> anagrams = Solver.GetAnagrams(word); Assert.IsNull(anagrams); }
public void ReturnListOfCorrectLength() { int maxListLength = Int32.Parse(Config["maxListLength1"]); AnagramSolver Solver = new AnagramSolver(maxListLength, Path); string word = Config["testWord1"]; IList <string> anagrams = Solver.GetAnagrams(word); Assert.IsTrue(anagrams.Count == maxListLength); }
public void FindCorrectAnagramsForGivenWord() { AnagramSolver Solver = new AnagramSolver(Path); string word = Config["testWord1"]; IList <string> anagrams = Solver.GetAnagrams(word); Assert.IsTrue(anagrams.Contains("dugnas")); Assert.IsTrue(anagrams.Contains("gandus")); }
public void GetAnagrams_WordLengthIsSmallerThanSmallestWordInAList_ResultCount0() { var testAnagrams = _anagramSolver2.GetAnagrams("a"); Assert.IsEmpty(testAnagrams); }
public void GetAnagrams_WordContainsLithuanianChars_ResultCountIs0() { var testAnagrams = _anagramSolver1.GetAnagrams("Šilutė"); Assert.IsEmpty(testAnagrams); }