public void ValidateCounter_should_invoke_action_if_threshold_is_exceeded()
        {
            bool wasInvoked = false;
            var requestCounterThreshold = new RequestCounterThreshold(5, () => { wasInvoked = true; });
            requestCounterThreshold.ValidateCounter(6);

            wasInvoked.ShouldBeTrue();
        }
Example #2
0
 public RequestCounter(ICommandRunner commandRunner, RequestCounterThreshold threshold)
 {
     _commandRunner = commandRunner;
     _threshold     = threshold;
 }
 public void no_threshold_value_set_should_return_false_for_HasThreshold()
 {
     var requestCounterThreshold = new RequestCounterThreshold(0, () => { });
     requestCounterThreshold.HasThreshold.ShouldBeFalse();
 }
 public void threshold_value_set_should_return_true_for_HasThreshold()
 {
     var requestCounterThreshold = new RequestCounterThreshold(1, () => { });
     requestCounterThreshold.HasThreshold.ShouldBeTrue();
 }