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 QueryCacheCodeTableTest_NotInDictionary()
        {
            CodeTableCache  cache = new CodeTableCache();
            List <CaseType> ct    = cache.QueryCacheCodeTable <CaseType>("1==1");

            Assert.IsNotNull(ct, "Returned list was null.");
            Assert.AreEqual(0, ct.Count(), "There should not be any rows");
        }
        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.");
        }
        public void QueryCacheCodeTableTest()
        {
            CodeTableCache        cache  = new CodeTableCache();
            List <CaseStatusType> csList = new List <CaseStatusType>();

            csList.Add(new CaseStatusType()
            {
                Code = "C", Description = "Desc"
            });
            cache.AddToDictionary(csList);

            List <CaseStatusType> result = cache.QueryCacheCodeTable <CaseStatusType>("1==1");

            Assert.AreEqual(1, result.Count(), "Result did not have one item");
            Assert.IsNotNull(result.FirstOrDefault(ct => ct.Code == "C"), "Result did not have the right data");
        }