public void CreateCache_CacheAlreadyExists_Throws_InvalidOperationException() { CacheManagerFactory sut = new CacheManagerFactory(); try { CacheManager testCache = sut.CreateCache("test123", new TimeSpan()); Assert.IsNotNull(testCache); sut.CreateCache("test123", new TimeSpan(), true, false); } finally { sut.RemoveCache("test123"); } }
public void GetCache_CacheFound_Returns_ValidCacheManager() { CacheManagerFactory sut = new CacheManagerFactory(); try { CacheManager testCache = sut.CreateCache("test123a", new TimeSpan()); Assert.IsNotNull(testCache); Assert.IsNotNull(sut.GetCache("test123a")); } finally { sut.RemoveCache("test123a"); } }
public void ClearAllCaches_RemovesAllCacheItems_Success() { CacheManagerFactory sut = new CacheManagerFactory(); try { CacheManager testCache = sut.CreateCache("clear all", new TimeSpan(), false, true); Assert.IsNotNull(testCache); testCache.Add("test 1", new CacheItem("test 1", true)); Assert.AreEqual(1, testCache.Count); sut.ClearAllCaches(); Assert.AreEqual(0, testCache.Count); } finally { sut.RemoveCache("clear all"); } }
public void RemoveCache_InvalidParam_CacheName_EmptyString_Throws_ArgumentNullException() { CacheManagerFactory sut = new CacheManagerFactory(); sut.RemoveCache(""); }