public void Can_Remove_And_Clear()
        {
            var dictionary = new EhcacheServerDictionary(endpoint, "sampleCache1");
            dictionary.Clear();

            dictionary["testKey1"] = "testValue";
            dictionary["testKey2"] = "testValue";
            dictionary["testKey3"] = "testValue";

            Assert.AreEqual(3, dictionary.Count);
            dictionary.Remove("testKey1");
            Assert.AreEqual(2, dictionary.Count);
            dictionary.Clear();
            Assert.AreEqual(0, dictionary.Count);
        }
Exemplo n.º 2
0
        public void Can_Get_Count()
        {
            var dictionary = (IDictionary)new EhcacheServerDictionary(endpoint, "sampleCache1");

            Assert.AreEqual(0, dictionary.Count);
            dictionary["testKey1"] = "testValue1";
            Assert.AreEqual(1, dictionary.Count);
            dictionary["testKey2"] = "testValue2";
            Assert.AreEqual(2, dictionary.Count);

            var dictionary2 = new EhcacheServerDictionary(endpoint, "sampleCache2");
            dictionary2.Clear();

            dictionary2["testKey1"] = "testValue1";
            Assert.AreEqual(2, dictionary.Count);
            Assert.AreEqual(1, dictionary2.Count);
        }