public void ExpiringDictionary_SnapshotAndRefresh_Refreshes_Items() { using (var map = new ExpiringDictionary <int, string>(10, 1)) { map.Add(1, "A"); map.Add(2, "B"); _Clock.AddMilliseconds(10); var snapshot = map.SnapshotAndRefresh(); HeartbeatTick(); Assert.AreEqual(2, map.Count); 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"))); } }