public void LruTest1() { InMemoryCache imc = new InMemoryCache(); Assert.AreEqual(Int32.MaxValue, imc.MaxItems); imc.PutItem("A", "A1", new string[0], TimeSpan.Zero, DateTime.MaxValue); imc.PutItem("B", "B1", new string[0], TimeSpan.Zero, DateTime.MaxValue); imc.PutItem("C", "C1", new string[0], TimeSpan.Zero, DateTime.MaxValue); imc.PutItem("D", "D1", new string[0], TimeSpan.Zero, DateTime.MaxValue); Assert.AreEqual("D|C|B|A", GetItemKeysInLruOrder(imc)); object value; imc.GetItem("D", out value); Assert.AreEqual("D|C|B|A", GetItemKeysInLruOrder(imc)); imc.GetItem("C", out value); Assert.AreEqual("C|D|B|A", GetItemKeysInLruOrder(imc)); imc.GetItem("D", out value); Assert.AreEqual("D|C|B|A", GetItemKeysInLruOrder(imc)); imc.GetItem("A", out value); Assert.AreEqual("A|D|C|B", GetItemKeysInLruOrder(imc)); imc.GetItem("B", out value); Assert.AreEqual("B|A|D|C", GetItemKeysInLruOrder(imc)); imc.InvalidateItem("B"); Assert.AreEqual("A|D|C", GetItemKeysInLruOrder(imc)); imc.InvalidateItem("C"); Assert.AreEqual("A|D", GetItemKeysInLruOrder(imc)); imc.InvalidateItem("A"); Assert.AreEqual("D", GetItemKeysInLruOrder(imc)); imc.InvalidateItem("D"); Assert.AreEqual("", GetItemKeysInLruOrder(imc)); }