コード例 #1
0
        public void Should_update_cache_Data_On_Reload()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);

            dbService = GetDbService();
            dbService.Delete(1);
            Assert.Equal(TOTAL_PLAN, helper.GetAllPlans().Count);     //before reload
            helper.ReloadFromDBAndUpdateCache( );                     //PlanData inside this clas is now reinitialized from memory cache data
            Assert.Equal(TOTAL_PLAN - 1, helper.GetAllPlans().Count); //before reload
        }
コード例 #2
0
        public void Should_Return_Correct_List_Of_Plans(bool includeDev)
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);

            if (includeDev)
            {
                Assert.Equal(TOTAL_PLAN, helper.GetAllPlans(includeDev).Count);
            }
            else
            {
                Assert.Equal(TOTAL_PLAN - TOTAL_DEV_PLAN, helper.GetAllPlans(includeDev).Count);
            }
        }