public void CheckCleanup() { RingDictionary<string> d = new RingDictionary<string>(2); Assert.AreEqual(0, d.Count); Assert.AreEqual(0, d.Generation - d.StartGeneration); d.AddValue("A"); Assert.AreEqual(1, d.Count); Assert.AreEqual(1, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("A")); d.AddValue("B"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("B")); d.AddValue("C"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("C")); Assert.IsTrue(d.ContainsValue("B")); Assert.IsFalse(d.ContainsValue("A")); d.AddValue("D"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("D")); Assert.IsTrue(d.ContainsValue("C")); Assert.IsFalse(d.ContainsValue("B")); }
public void CheckCleanup() { RingDictionary <string> d = new RingDictionary <string>(2); Assert.AreEqual(0, d.Count); Assert.AreEqual(0, d.Generation - d.StartGeneration); d.AddValue("A"); Assert.AreEqual(1, d.Count); Assert.AreEqual(1, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("A")); d.AddValue("B"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("B")); d.AddValue("C"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("C")); Assert.IsTrue(d.ContainsValue("B")); Assert.IsFalse(d.ContainsValue("A")); d.AddValue("D"); Assert.AreEqual(2, d.Count); Assert.AreEqual(2, d.Generation - d.StartGeneration); Assert.IsTrue(d.ContainsValue("D")); Assert.IsTrue(d.ContainsValue("C")); Assert.IsFalse(d.ContainsValue("B")); }
static void Main(string[] args) { var rD = new RingDictionary(50); for (int i = 0; i < 75; i++) { rD.Add(i, i); } foreach (var item in rD.Keys) { Console.WriteLine("{0} {1}", item, rD[item]); } }