public void WhenConfiguredWithCacheAdministrator_Get_ShouldNotTryAndRegisterCacheTwice()
        {
            // given
            var cacheProvider = new GlobalCacheProvider {
                CacheAdministator = new CacheAdministator()
            };

            cacheProvider.Get <ICache>("SomeCacheName");

            // when
            cacheProvider.Get <ICache>("SomeCacheName");

            // then
            Assert.That(cacheProvider.CacheAdministator.AllCaches.Count(), Is.EqualTo(1));
        }
        public void Get_ShouldDefaultToReturningSimpleInmemoryCacheExtendedWithDefaultDecorators()
        {
            // given
            CacheDecoratorOptions.Default = new CacheDecoratorOptions {
                IsPausableOn = true
            };

            // when
            ICache cache = _cacheProvider.Get <ICache>("SomeCacheName");

            // then
            Assert.That(cache, Is.Not.Null);
            List <ICache> chain = cache.GetDecoratorChainAndDecorated().ToList();

            Assert.That(chain.Count, Is.EqualTo(2), "Chain Count");
            Assert.That(chain[0], Is.InstanceOf <IPausableCache>(), "First");
            Assert.That(chain[1], Is.InstanceOf <SimpleInmemoryCache>(), "Second");
        }
        public void WhenConfiguredWithCacheAdministrator_Get_ShouldRegisterCache()
        {
            // given
            var cacheProvider = new GlobalCacheProvider {
                CacheAdministator = new CacheAdministator()
            };

            // when
            ICache cache = cacheProvider.Get <ICache>("SomeCacheName");

            // then
            Assert.That(cacheProvider.CacheAdministator.Contains(cache), Is.True);
        }