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

            dictionary["testKey"] = "testValue";

            Assert.AreEqual("testValue", dictionary["testKey"]);

            dictionary = new EhcacheServerDictionary(endpoint, "sampleCache1");
            Assert.AreEqual("testValue", dictionary["testKey"]);
        }
        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);
        }
示例#3
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);
        }
 public void Cannot_Iterate_Through_Keys_As_Not_Supported_By_Ehcache_Server()
 {
     var dictionary = new EhcacheServerDictionary(endpoint, "sampleCache1");
     
     try
     {
         var keys = dictionary.Keys;
         Assert.Fail("Should have thrown a NotImplementedException");
     }
     catch (NotImplementedException)
     {
         // This is to be expected.
     }
 }