Esempio n. 1
0
        public void Item_should_be_removed_on_demand()
        {
            ICache cache = new FifoCache();

            cache[0] = 0;
            Assert.That(cache[0], Is.Not.Null);

            cache.Remove(0);
            Assert.That(cache[0], Is.Null);
        }
Esempio n. 2
0
        public void Cache_should_be_clear_on_demand()
        {
            ICache cache = new FifoCache();

            for (int i = 0; i < 5; i++)
            {
                cache[i] = i;
            }

            Assert.That(cache[0], Is.Not.Null);
            Assert.That(cache[4], Is.Not.Null);
            cache.Clear();
            Assert.That(cache[0], Is.Null);
            Assert.That(cache[4], Is.Null);
        }
Esempio n. 3
0
        public void First_item_should_be_removed()
        {
            FifoCache cache = new FifoCache();
            cache.Size = 5;

            for (int i = 0; i < 5; i++)
            {
                cache[i]= i;
            }

            Assert.That(cache[0], Is.EqualTo(0));
            cache[5] = 5;
            Assert.That(cache[0], Is.Null);
            Assert.That(cache.Size, Is.EqualTo(5));
        }