示例#1
0
        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));
 }
示例#3
0
        public void WhenUsingCachedWordsForNonExistentDictionary_ThenWordsSourceThrowsFileNotFoundException()
        {
            var words = WordsCache.Get(DictionaryThatDoesNotExist);

            Should.Throw <FileNotFoundException>(() => words.Next());
        }
示例#4
0
        public void WhenRequestingAnItemNotInTheCache_ThenReturnsWordsSourceForItemDictionary()
        {
            var words = WordsCache.Get(DictionaryThatDoesNotExist);

            words.DictionaryName.ShouldBe(DictionaryThatDoesNotExist);
        }