示例#1
0
        public void Should_return_second_plan_for_upgrade_if_plan_is_null()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var upgradePlan = sut.GetPlanUpgrade(null);

            upgradePlan.ShouldBeEquivalentTo(BasicPlan);
        }
示例#2
0
        public void Should_return_fitting_app_plan()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var plan = sut.GetPlanForApp(CreateApp("basic"));

            plan.ShouldBeEquivalentTo(BasicPlan);
        }
示例#3
0
        public void Should_smallest_plan_if_none_fits()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var plan = sut.GetPlanForApp(CreateApp("enterprise"));

            plan.ShouldBeEquivalentTo(FreePlan);
        }
示例#4
0
        public void Should_return_next_plan_if_plan_is_upgradeable()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var upgradePlan = sut.GetPlanUpgradeForApp(CreateApp("free"));

            upgradePlan.ShouldBeEquivalentTo(BasicPlan);
        }
示例#5
0
        public void Should_return_infinite_if_nothing_configured(string planId)
        {
            var sut = new ConfigAppPlansProvider(Enumerable.Empty <ConfigAppLimitsPlan>());

            var plan = sut.GetPlanForApp(CreateApp(planId));

            plan.ShouldBeEquivalentTo(InfinitePlan);
        }
示例#6
0
        public void Should_return_second_plan_for_upgrade_if_plan_not_found()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var upgradePlan = sut.GetPlanUpgradeForApp(CreateApp("enterprise"));

            upgradePlan.ShouldBeEquivalentTo(BasicPlan);
        }
示例#7
0
        public void Should_not_return_plan_for_upgrade_if_plan_is_highest_plan()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var upgradePlan = sut.GetPlanUpgradeForApp(CreateApp("basic"));

            Assert.Null(upgradePlan);
        }
示例#8
0
        public void Should_return_infinite_plan_for_free_plan_if_not_found()
        {
            var sut = new ConfigAppPlansProvider(Enumerable.Empty <ConfigAppLimitsPlan>());

            var plan = sut.GetFreePlan();

            plan.Should().NotBeNull();
        }
示例#9
0
        public void Should_return_free_plan()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var plan = sut.GetFreePlan();

            plan.Should().BeEquivalentTo(FreePlan);
        }
        public void Should_return_fitting_app_plan()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var result = sut.GetPlanForApp(CreateApp("basic"));

            result.Should().BeEquivalentTo((BasicPlan, "basic"));
        }
        public void Should_smallest_plan_if_none_fits()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var result = sut.GetPlanForApp(CreateApp("enterprise"));

            result.Should().BeEquivalentTo((FreePlan, "free"));
        }
示例#12
0
        public void Should_check_plan_exists()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            Assert.True(sut.IsConfiguredPlan("basic"));
            Assert.True(sut.IsConfiguredPlan("free"));

            Assert.False(sut.IsConfiguredPlan("infinite"));
            Assert.False(sut.IsConfiguredPlan("invalid"));
            Assert.False(sut.IsConfiguredPlan(null));
        }
        public void Should_smallest_plan_if_none_fits()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var plan = sut.GetPlanForApp(CreateApp("Enterprise"));

            plan.ShouldBeEquivalentTo(new ConfigAppLimitsPlan
            {
                Id              = "free",
                Name            = "Free",
                MaxApiCalls     = 50000,
                MaxAssetSize    = 1024 * 1024 * 10,
                MaxContributors = 2
            });
        }
        public void Should_return_fitting_app_plan()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            var plan = sut.GetPlanForApp(CreateApp("basic"));

            plan.ShouldBeEquivalentTo(new ConfigAppLimitsPlan
            {
                Id              = "basic",
                Name            = "Basic",
                MaxApiCalls     = 150000,
                MaxAssetSize    = 1024 * 1024 * 2,
                MaxContributors = 5
            });
        }
        public void Should_return_infinite_if_nothing_configured(string planId)
        {
            var sut = new ConfigAppPlansProvider(Enumerable.Empty <ConfigAppLimitsPlan>());

            var plan = sut.GetPlanForApp(CreateApp(planId));

            plan.ShouldBeEquivalentTo(new ConfigAppLimitsPlan
            {
                Id              = "infinite",
                Name            = "Infinite",
                MaxApiCalls     = -1,
                MaxAssetSize    = -1,
                MaxContributors = -1
            });
        }
示例#16
0
        public void Should_return_plans()
        {
            var sut = new ConfigAppPlansProvider(Plans);

            Plans.OrderBy(x => x.MaxApiCalls).ShouldBeEquivalentTo(sut.GetAvailablePlans());
        }