Ejemplo n.º 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));
 }
Ejemplo n.º 3
0
        public void WhenUsingCachedWordsForNonExistentDictionary_ThenWordsSourceThrowsFileNotFoundException()
        {
            var words = WordsCache.Get(DictionaryThatDoesNotExist);

            Should.Throw <FileNotFoundException>(() => words.Next());
        }
Ejemplo n.º 4
0
        public void WhenRequestingAnItemNotInTheCache_ThenReturnsWordsSourceForItemDictionary()
        {
            var words = WordsCache.Get(DictionaryThatDoesNotExist);

            words.DictionaryName.ShouldBe(DictionaryThatDoesNotExist);
        }