コード例 #1
0
        public void Should_Return_Null_Definition_For_Valid_Option_Name_But_Invalid_Plan_Id()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper  = new PlansReader(dbService, m, TheLogger);
            var planDef = helper[100, "Option 1"];//first plan in collection is a dev

            Assert.Null(planDef);
        }
コード例 #2
0
        public void Should_Return_Null_Plan_For_Invalid_Id()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);
            var plan   = helper[100];//first plan in collection is a dev

            Assert.Null(plan);
        }
コード例 #3
0
        public void Should_Return_Null_Plan_For_Invalid_Name()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);
            var plan   = helper["Test Plan -1"];//invalid name

            Assert.Null(plan);
        }
コード例 #4
0
        public void Should_Return_Valid_Plan_For_Valid_Name()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);
            var plan   = helper["Test Plan 1"];//first plan in collection is a dev

            Assert.NotNull(plan);
            Assert.Equal(1, plan.Id);
        }
コード例 #5
0
        public void Should_Return_A_Valid_Definition_For_valid_Option_Name_And_Plan_Id()
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper  = new PlansReader(dbService, m, TheLogger);
            var planDef = helper[1, "Option 1"];//first plan in collection is a dev

            Assert.NotNull(planDef);
            Assert.Equal(1, planDef.Id);
            Assert.Equal("Value 1", planDef.OptionValue);
        }
コード例 #6
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
        }
コード例 #7
0
        public void Test_Upgradibility(int planId, bool includeDev)
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);

            if (TOTAL_PLAN == planId)   /*highest index = highest plan*/
            {
                Assert.False(helper.CanUpgrade(planId, includeDev));
            }
            else
            {
                Assert.True(helper.CanUpgrade(planId, includeDev));
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
0
        public void Should_Return_A_List_Of_Valid_Upgradable_Plan_List(int currentPlanId)
        {
            var dbService = GetDbService();
            var m         = new MemoryCache(new MemoryCacheOptions()
            {
            });
            var helper = new PlansReader(dbService, m, TheLogger);

            if (currentPlanId == TOTAL_PLAN)
            {
                Assert.Empty(helper.GetAvailableUpgrades(currentPlanId));
            }
            else
            {
                Assert.Equal(TOTAL_PLAN - currentPlanId, helper.GetAvailableUpgrades(currentPlanId).Count);
            }
        }