Ejemplo n.º 1
0
        public void if_match_rules_and_enabled_rollout_0_percent_should_return_false()
        {
            var sut = new KFeatureFlag("sut", KTargeting.EnabledForSomeUsers, new string[] { },
                                       new KInlineRule[] { }, true, KPercentageRollout.Create(0));

            sut.Evaluate(Fixture.store, Fixture.spain_user).Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void if_no_rules_and_disabled_rollout_should_return_false()
        {
            var sut = new KFeatureFlag("sut", KTargeting.EnabledForSomeUsers, new string[] { },
                                       new KInlineRule[] { }, false, KPercentageRollout.Create(100));

            sut.Evaluate(Fixture.store, Fixture.empty_user).Should().BeFalse();
        }
Ejemplo n.º 3
0
 public KFeatureFlag(string key, KTargeting targeting, IEnumerable <string> identities,
                     IEnumerable <KInlineRule> rules, bool enableRollout, KPercentageRollout rollout)
 {
     Key           = key;
     Targeting     = targeting;
     Identities    = identities;
     Rules         = rules;
     EnableRollout = enableRollout;
     Rollout       = rollout;
 }
Ejemplo n.º 4
0
        public void if_match_rules_and_enabled_rollout_100_percent_should_return_true()
        {
            var sut = new KFeatureFlag("sut", KTargeting.EnabledForSomeUsers, new string[] { },
                                       new List <KInlineRule>
            {
                new KInlineRule(0, new[] { new KEqualsStatement("country", new[] { KStringValue.Create("spain") }) })
            },
                                       true, KPercentageRollout.Create(100));

            sut.Evaluate(Fixture.store, Fixture.spain_user).Should().BeTrue();
        }
Ejemplo n.º 5
0
 public void true_rollout()
 {
     KPercentageRollout.Create(50).Evaluate("a").Should().BeTrue();
 }
Ejemplo n.º 6
0
 public void false_rollout()
 {
     KPercentageRollout.Create(50).Evaluate("A").Should().BeFalse();
 }