public void ClearCacheTest() { CodeTableCache cache = new CodeTableCache(); List <CaseType> typeList = new List <CaseType>(); typeList.Add(new CaseType() { Code = "C", Description = "Desc" }); typeList.Add(new CaseType() { Code = "C2", Description = "Desc2" }); cache.CodeTableDictionary.Add(typeof(CaseType), typeList); List <CaseType> cachedList = cache.QueryCacheCodeTable <CaseType>(CodeLookupHelper.ALL_CODES_QUERY); Assert.AreEqual(2, cachedList.Count(), "Initial count was not 2"); cache.ClearCache <CaseType>(); cachedList = cache.QueryCacheCodeTable <CaseType>(CodeLookupHelper.ALL_CODES_QUERY); Assert.AreEqual(0, cachedList.Count(), "Count was not 0 after clearing."); }
public void ClearCache_TypeNotInDictionary() { CodeTableCache cache = new CodeTableCache(); cache.ClearCache <CaseType>(); List <CaseType> cachedList = cache.QueryCacheCodeTable <CaseType>(CodeLookupHelper.ALL_CODES_QUERY); Assert.AreEqual(0, cachedList.Count(), "Count was not 0 after clearing."); }