예제 #1
0
        public void RemoveTest()
        {
            int radix = 5;
            int arraySize = 10;
            PartitionedMemoryCacher<string> mc = new PartitionedMemoryCacher<string>(radix, arraySize);

            mc.Add(0, "sıfır");
            mc.Add(1, "bir");

            //init contidions
            Assert.AreEqual(2, mc.Count);
            Assert.AreEqual(1, mc[0].Count);
            Assert.AreEqual(1, mc[1].Count);

            mc.Remove(0);

            //phase 1 conditions
            Assert.AreEqual(1, mc.Count);
            Assert.AreEqual(0, mc[0].Count);
            Assert.AreEqual(1, mc[1].Count);

            mc.Remove(1);

            //phase 2 conditions
            Assert.AreEqual(0, mc.Count);
            Assert.AreEqual(0, mc[0].Count);
            Assert.AreEqual(0, mc[1].Count);
        }