public void TryGetValue() { var dic = new qckdev.Collections.CacheDictionary <int, string>() { CacheTimeout = TimeSpan.FromMilliseconds(200) }; dic.Add(1, "a"); dic.Add(2, "b"); dic.Add(3, "c"); dic.TryGetValue(1, out string value); Assert.AreEqual("a", value); }
public void TryGetValue_WithDelay() { 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"); dic.TryGetValue(1, out string value); Assert.AreEqual(null, value); }