Exemplo n.º 1
0
        public void CustomMemoryCache_AddOrGetExistingCacheAdd()
        {
            var policy = new CacheItemPolicy {
                SlidingExpiration = new TimeSpan(0, 10, 0)
            };
            var addCache = _customMemoryCache.AddOrGetExisting(Key, Value, policy);

            Assert.IsNull(addCache);
            var getCacheValue = _customMemoryCache.AddOrGetExisting(Key, Value, policy);

            Assert.IsNotNull(getCacheValue);
            Assert.AreEqual(Value, getCacheValue);
        }