public void AddCacheEntryMulitpleTimesThorowsArgumentExceptionError() { LRUCache <int, int> LRUCacheTest = new LRUCache <int, int>(); LRUCacheTest.AddCacheEntry(10, 100); LRUCacheTest.AddCacheEntry(10, 100); }
public void AddingCatchedItemAndGettingthesameCatcheUsingKeys() { LRUCache <int, int> LRUCacheTest = new LRUCache <int, int>(); LRUCacheTest.AddCacheEntry(10, 100); int cacheValue = LRUCacheTest.GetCacheEntry(10); Assert.AreEqual(cacheValue, 100); }
public static void Main(string[] args) { LRUCache <int, int> lRUCacheImplemenation = new LRUCache <int, int>(); lRUCacheImplemenation.AddCacheEntry(10, 100); lRUCacheImplemenation.AddCacheEntry(20, 200); Console.WriteLine(lRUCacheImplemenation.GetCacheEntry(10)); Console.WriteLine(lRUCacheImplemenation.GetCacheEntry(40)); lRUCacheImplemenation.AddCacheEntry(30, 300); lRUCacheImplemenation.AddCacheEntry(40, 400); lRUCacheImplemenation.AddCacheEntry(50, 500); lRUCacheImplemenation.AddCacheEntry(60, 600); lRUCacheImplemenation.AddCacheEntry(70, 700); lRUCacheImplemenation.ClearCache(); lRUCacheImplemenation.CACHE_SIZE = 10; Console.WriteLine(lRUCacheImplemenation.GetCacheEntry(30)); }
public void LeastRecentlyUsedCache() { LRUCache <int, int> LRUCacheTest = new LRUCache <int, int>(); LRUCacheTest.CACHE_SIZE = 5; LRUCacheTest.AddCacheEntry(10, 100); LRUCacheTest.AddCacheEntry(20, 120); LRUCacheTest.AddCacheEntry(30, 130); LRUCacheTest.AddCacheEntry(40, 140); LRUCacheTest.AddCacheEntry(50, 150); LRUCacheTest.AddCacheEntry(60, 160); int actualValue = LRUCacheTest.GetCacheEntry(30); Assert.AreEqual(actualValue, 130); }