Esempio n. 1
0
        public void ContainsKey()
        {
            var dic = new qckdev.Collections.CacheDictionary <int, string>()
            {
                CacheTimeout = TimeSpan.FromMilliseconds(200)
            };

            dic.Add(1, "a");
            dic.Add(2, "b");
            dic.Add(3, "c");

            Assert.IsTrue(dic.ContainsKey(1));
        }
Esempio n. 2
0
        public void ContainsKey_WithDelay(int key, bool expected)
        {
            var dic = new qckdev.Collections.CacheDictionary <int, string>()
            {
                CacheTimeout = TimeSpan.FromMilliseconds(200)
            };

            dic.Add(1, "a");
            System.Threading.Thread.Sleep(210);
            dic.Add(2, "b");
            dic.Add(3, "c");

            Assert.AreEqual(expected, dic.ContainsKey(key));
        }