public void ExpiringDictionary_Snapshot_Does_Not_Refresh_Items() { using (var map = new ExpiringDictionary <int, string>(10, 1)) { map.Add(1, "1"); _Clock.AddMilliseconds(10); map.Snapshot(); HeartbeatTick(); Assert.AreEqual(0, map.Count); } }
public void ExpiringDictionary_Snapshot_Returns_Collection_Of_KeyValuePairs() { _Map.Add(1, "A"); _Map.Add(2, "B"); var snapshot = _Map.Snapshot(); _Map.Clear(); Assert.AreEqual(2, snapshot.Length); Assert.IsTrue(snapshot.Contains(new KeyValuePair <int, string>(1, "A"))); Assert.IsTrue(snapshot.Contains(new KeyValuePair <int, string>(2, "B"))); }