Beispiel #1
0
        public void CustomMemoryCache_Remove()
        {
            var policy = new CacheItemPolicy {
                SlidingExpiration = new TimeSpan(0, 10, 0)
            };
            var cacheItem = new CacheItem(Key, Value);

            _customMemoryCache.Set(cacheItem, policy);
            var removedCacheItem = _customMemoryCache.Remove(Key);

            Assert.AreEqual(cacheItem.Value, removedCacheItem);
            var cacheItemAfetrRemoved = _customMemoryCache.Get(Key);

            Assert.IsNull(cacheItemAfetrRemoved);
        }