public void WillLookupCategoryInTheCategoryCacheEntryRepository()
        {
            var strategy = TestableCachedScrappingFetchWikiUrlStrategyTests.Create();

            var category = new Category {
                Slug = "test"
            };

            strategy.GetUrl(category);

            strategy.CategoryCacheEntryRepository.Verify(s => s.FindByCategory(category), Times.Once());
        }
        public void WillCreateNewCacheEntryIfEntryNotFoundInRepository()
        {
            var strategy = TestableCachedScrappingFetchWikiUrlStrategyTests.Create();

            var category = new Category {
                Slug = "test"
            };

            strategy.CategoryCacheEntryRepository.Setup(r => r.FindByCategory(category))
            .Returns((CategoryCacheEntry)null);

            strategy.GetUrl(category);

            strategy.CategoryCacheEntryRepository.Verify(r => r.Add(It.IsAny <CategoryCacheEntry>()), Times.Once());
            strategy.UnitOfWork.Verify(u => u.Commit(), Times.Once());
        }
        public void WillCallBaseCallGetUrlIfCacheEntryNotFound()
        {
            var strategy = TestableCachedScrappingFetchWikiUrlStrategyTests.Create();

            var category = new Category {
                Slug = "test"
            };

            strategy.CategoryCacheEntryRepository.Setup(r => r.FindByCategory(category))
            .Returns((CategoryCacheEntry)null);

            var baseGetUrlCallCount = strategy.BaseClassGetUrlCallCount;

            strategy.GetUrl(category);

            Assert.Equal(baseGetUrlCallCount + 1, strategy.BaseClassGetUrlCallCount);
        }