Ejemplo n.º 1
0
 public void ExpiringList_AddRange_Adds_A_Range_Of_Items()
 {
     _List.AddRange(new string[] { "o1", "p2" });
     Assert.AreEqual("o1", _List.Find(r => r == "o1"));
     Assert.AreEqual("p2", _List.Find(r => r == "p2"));
     Assert.AreEqual(2, _List.Count);
     Assert.AreEqual(1, _CountChangedCallCount);
     Assert.AreEqual(2, _LastCountChangedCounter);
 }
Ejemplo n.º 2
0
        public void ExpiringList_AddRangeOrRefresh_Adds_Or_Refreshes_A_Range_Of_Items()
        {
            using (var list = new ExpiringList <string>(10, 10)) {
                list.AddRange(new string[] { "1", "2" });
                HeartbeatTick();

                _Clock.AddMilliseconds(10);
                list.AddRange(new string[] { "2", "3" });
                HeartbeatTick();

                Assert.AreEqual(2, list.Count);
                Assert.AreEqual(null, list.Find(r => r == "1"));
                Assert.AreEqual("2", list.Find(r => r == "2"));
                Assert.AreEqual("3", list.Find(r => r == "3"));
            }
        }
Ejemplo n.º 3
0
        public void ExpiringList_Find_Does_Not_Refresh_Items()
        {
            using (var list = new ExpiringList <string>(10, 10)) {
                list.Add("1");

                _Clock.AddMilliseconds(10);
                Assert.AreEqual("1", list.Find(r => r == "1"));

                HeartbeatTick();
                Assert.AreEqual(0, list.Count);
            }
        }