public void TestClear() { string key = "key1"; string value = "value"; ICache cache = provider.BuildCache("nunit", props); Assert.IsNotNull(cache, "no cache returned"); // add the item cache.Put(key, value); Thread.Sleep(1000); // make sure it's there object item = cache.Get(key); Assert.IsNotNull(item, "couldn't find item in cache"); // clear the cache cache.Clear(); // make sure we don't get an item item = cache.Get(key); Assert.IsNull(item, "item still exists in cache"); }
public void TestPut() { string key = "key1"; string value = "value"; ICache cache = provider.BuildCache("nunit", props); Assert.IsNotNull(cache, "no cache returned"); if (cache.Get(key) != null) { cache.Remove(key); } Assert.ShouldNotBeNull(cache.Get(key), "cache returned an item we didn't add !?!"); cache.Put(key, value); Thread.Sleep(100); object item = cache.Get(key); Assert.IsNotNull(item); Assert.AreEqual(value, item, "didn't return the item we added"); }