public void StoreCategoryThrowsExceptionWithNullCategoryTest()
        {
            var cache  = Substitute.For <IMemoryCache>();
            var config = Substitute.For <ICacheConfig>();

            var sut = new CategoryCache(cache, config);

            Action action = () => sut.StoreCategory(null);

            action.Should().Throw <ArgumentNullException>();
        }
        public void StoreCategoryWritesCategoryToCacheTest()
        {
            var expected    = Model.Create <Category>();
            var cacheKey    = "Category|" + expected.Group + "|" + expected.Name;
            var cacheExpiry = TimeSpan.FromMinutes(23);

            var cache      = Substitute.For <IMemoryCache>();
            var config     = Substitute.For <ICacheConfig>();
            var cacheEntry = Substitute.For <ICacheEntry>();

            config.CategoriesExpiration.Returns(cacheExpiry);
            cache.CreateEntry(cacheKey).Returns(cacheEntry);

            var sut = new CategoryCache(cache, config);

            sut.StoreCategory(expected);

            cacheEntry.Value.Should().Be(expected);
            cacheEntry.SlidingExpiration.Should().Be(cacheExpiry);
        }