public void WhenRequestingAnItemInTheCache_ThenReturnsSameItem() { var words1 = WordsCache.Get(FromDictionary.InternetUrl); var words2 = WordsCache.Get(FromDictionary.InternetUrl); words1.ShouldBeSameAs(words2); }
/// <summary> /// Gets a data source for a file dictionary, which can be built-in or a user-supplied text file. /// </summary> /// <param name="dictionaryName">The name of the file dictionary, without the extension. /// Recommended to use the FromDictionary list of constants for the built-in file dictionaries. /// Just use a normal string for user-supplied text files.</param> /// <returns></returns> public Words Words(string dictionaryName) { return(WordsCache.Get(dictionaryName)); }
public void WhenUsingCachedWordsForNonExistentDictionary_ThenWordsSourceThrowsFileNotFoundException() { var words = WordsCache.Get(DictionaryThatDoesNotExist); Should.Throw <FileNotFoundException>(() => words.Next()); }
public void WhenRequestingAnItemNotInTheCache_ThenReturnsWordsSourceForItemDictionary() { var words = WordsCache.Get(DictionaryThatDoesNotExist); words.DictionaryName.ShouldBe(DictionaryThatDoesNotExist); }