public void Should_Not_Call_Words_Repository_When_No_Word_Is_Received(string searchValue)
        {
            _wordsRepository.GetSearchedWords(searchValue).Returns(new List <WordResponseModel> {
            });

            _dictionaryController.Search(searchValue);

            _wordsRepository.DidNotReceive().GetSearchedWords(searchValue);
        }
Exemplo n.º 2
0
        public void Should_Use_Anagrams_Cache_Only(string word, string userIp)
        {
            _cacheRepository.GetCachedAnagrams(word).Returns(new List <WordModel>()
            {
                new WordModel(word)
            });
            _wordsRepository.GetWords().Returns(_dummyWordsRepository.GetWords());
            _anagramSolver.GetAnagrams(word, _dummyWordsRepository.GetWords()).Returns(new List <WordModel>()
            {
                new WordModel(word)
            });

            _anagramsService.GetAnagrams(word, userIp);

            _cacheRepository.Received().GetCachedAnagrams(word);
            _wordsRepository.DidNotReceive().GetWords();
            _anagramSolver.DidNotReceive().GetAnagrams(word, _wordsRepository.GetWords());
        }