public static Func <Task <bool> > WhenEvaluating( this IsGreaterThanStrategyEvaluator evaluator, IsGreaterThanStrategy strategy, IDictionary <string, string> values) { return(() => evaluator.IsOn(strategy, values)); }
public async Task GivenNotGreaterThanStrategy_WhenEvaluating_ThenIGetOff() { var strategy = new IsGreaterThanStrategy { Settings = new NumericalStrategySettings { Value = 100 } }; await this .GivenEvaluator() .WhenEvaluating(strategy, new Dictionary <string, string> { { StrategySettings.GreaterThan, "0000" } }) .ThenIGet(false); }
public async Task GivenNegativeFloatingPointGreaterThanValue_WhenEvaluating_ThenIGetOn() { var strategy = new IsGreaterThanStrategy { Settings = new NumericalStrategySettings { Value = -5 } }; await this .GivenEvaluator() .WhenEvaluating(strategy, new Dictionary <string, string> { { StrategySettings.GreaterThan, "-1.1231231231" } }) .ThenIGet(true); }
public async Task GivenInvalidNumericalValue_WhenEvaluating_ThenIGetOff() { var strategy = new IsGreaterThanStrategy { Settings = new NumericalStrategySettings() { Value = 123.12345 } }; await this .GivenEvaluator() .WhenEvaluating(strategy, new Dictionary <string, string> { { StrategySettings.GreaterThan, "a" } }) .ThenIGet(false); }
public async Task GivenMissingSettingInValues_WhenEvaluating_ThenIGetOff() { var strategy = new IsGreaterThanStrategy { Settings = new NumericalStrategySettings() { Value = 123.12345 } }; await this .GivenEvaluator() .WhenEvaluating(strategy, new Dictionary <string, string> { { "something", "0" } }) .ThenIGet(false); }
public async Task GivenIsGreaterThanStrategy_WhenEvaluating_ThenIGetOn() { var serializer = this.GivenIStrategySettingsSerializer(); var strategy = new IsGreaterThanStrategy() { Settings = new NumericalStrategySettings() { Value = 1 } }; await this .GivenEvaluatorFactory() .WhenEvaluating( StrategyNames.IsGreaterThan, serializer.Serialize(strategy.Settings), new Dictionary <string, string> { { StrategySettings.GreaterThan, "5" } }) .ThenIGet(true); }