Exemplo n.º 1
0
        public void Enumerate()
        {
            DictionaryCache <int, string> dictionaryCache;
            SimpleCache <int>             simpleCache;

            using (CacheInvalidator cacheInvalidator = new CacheInvalidator())
            {
                dictionaryCache = cacheInvalidator.CreateDictionaryCache <int, string>(key => key.ToString());
                simpleCache     = cacheInvalidator.CreateSimpleCache(() => 42);
                dictionaryCache.TryGetValue(simpleCache.Value, out string testValue);
                Assert.NotEmpty(cacheInvalidator);
            }
        }
Exemplo n.º 2
0
        public void ComplexTest()
        {
            DictionaryCache <int, string> dictionaryCache;
            SimpleCache <int>             simpleCache;

            using (CacheInvalidator cacheInvalidator = new CacheInvalidator())
            {
                dictionaryCache = cacheInvalidator.CreateDictionaryCache <int, string>(key => key.ToString());
                simpleCache     = cacheInvalidator.CreateSimpleCache(() => 42);
                dictionaryCache.TryGetValue(simpleCache.Value, out string testValue);
            }
            Assert.Equal(0, dictionaryCache.Count);
            Assert.False(simpleCache.Cached);
        }