public void CacheObjectAddItemToCache() { ICache cacheObject = new CachedMemory(100, @".\cache-test.txt"); Assert.IsTrue(File.Exists(@".\cache-test.txt")); Assert.AreEqual(cacheObject.GetCacheSize(), 0); cacheObject.Add("unittest-1", "item"); Assert.AreEqual(cacheObject.GetCacheSize(), 1); }
public void CacheObjectGetValueByIndex() { ICache cacheObject = new CachedMemory(1, @".\cache-test.txt"); Assert.IsTrue(File.Exists(@".\cache-test.txt")); Assert.AreEqual(cacheObject.GetCacheSize(), 0); cacheObject.Add("unittest", "item"); Assert.AreEqual(cacheObject.GetCacheSize(), 1); Assert.AreEqual(cacheObject.Get("unittest"), "item"); cacheObject.Add("unittest", "12345"); Assert.AreEqual(cacheObject.GetCacheSize(), 1); Assert.AreEqual(cacheObject.Get("unittest"), "12345"); }