public static Func <Task <bool> > WhenEvaluating(
     this IsInListStrategyEvaluator evaluator,
     IsInListStrategy strategy,
     IDictionary <string, string> values)
 {
     return(() => evaluator.IsOn(strategy, values));
 }
        public async Task GivenMissingSettingInValues_WhenEvaluating_ThenIGetOff()
        {
            var strategy = new IsInListStrategy {
                Settings = new IsInListStrategySettings
                {
                    Items = new List <string> {
                        "👌", "message for ou sir"
                    }
                }
            };

            await this
            .GivenEvaluator()
            .WhenEvaluating(strategy, new Dictionary <string, string> {
                { "something", "0" }
            })
            .ThenIGet(false);
        }
        public async Task GivenNotInListStrategy_WhenEvaluating_ThenIGetOff()
        {
            var strategy = new IsInListStrategy {
                Settings = new IsInListStrategySettings
                {
                    Items = new List <string> {
                        "👌", "message for ou sir"
                    },
                    ListName = "feats.someList"
                }
            };

            await this
            .GivenEvaluator()
            .WhenEvaluating(strategy, new Dictionary <string, string> {
                { strategy.Settings.ListName, "roger" }
            })
            .ThenIGet(false);
        }
Пример #4
0
        public async Task GivenIsInListStrategy_WhenEvaluating_ThenIGetStrategyResult()
        {
            var serializer = this.GivenIStrategySettingsSerializer();
            var strategy   = new IsInListStrategy {
                Settings = new IsInListStrategySettings
                {
                    Items = new List <string> {
                        "a", "😎🦝"
                    }
                }
            };

            await this
            .GivenEvaluatorFactory()
            .WhenEvaluating(
                StrategyNames.IsInList,
                serializer.Serialize(strategy.Settings),
                new Dictionary <string, string> {
                { strategy.Settings.ListName, "a" }
            })
            .ThenIGet(true);
        }