public void AnagramSearchTest1()
 {
     var reader = new MockReader { Strings = new string[]
     { "silent", "listen", "boaster", "reason", "kinship", "fresher" } };
     DictionaryCache.Reader = reader;
     IEnumerable<string> anagrams = DictionaryCache.GetInstance().GetAnagrams("refresh");
     Assert.AreEqual(anagrams.Count(), 1);
     Assert.IsTrue(anagrams.Contains("fresher"));
 }
 public void AnagramSearchTestWithMoreWordsInDictionary()
 {
     var reader = new MockReader { Strings = new string[] {"silent", "listen", "boaster", "reason", "kinship" } };
     DictionaryCache.Reader = reader;
     IEnumerable<string> anagrams = DictionaryCache.GetInstance().GetAnagrams("enlist");
     Assert.AreEqual(anagrams.Count(), 2);
     Assert.IsTrue(anagrams.Contains("silent"));
     Assert.IsTrue(anagrams.Contains("listen"));
 }
 public void ShouldBeAbleToOverrideReader()
 {
     var reader = new MockReader();
     DictionaryCache.Reader = reader;
     DictionaryCache.GetInstance();
     Assert.AreEqual(1, reader.CallCount);
 }
 public void ReturnEmptyListForGibberishWord()
 {
     var reader = new MockReader { Strings = new string[] { } };
     DictionaryCache.Reader = reader;
     IEnumerable<string> anagrams = DictionaryCache.GetInstance().GetAnagrams("matiz");
     Assert.IsEmpty(anagrams.ToList<string>());
 }
 public void SimpleAnagramLookup()
 {
     var reader = new MockReader { Strings = new string[] { "silent", "listen" } };
     DictionaryCache.Reader = reader;
     IEnumerable<string> anagrams =  DictionaryCache.GetInstance().GetAnagrams("enlist");
     Assert.AreEqual(anagrams.Count(), 2);
     Assert.IsTrue(anagrams.Contains("silent"));
     Assert.IsTrue(anagrams.Contains("listen"));
 }