Skip to content

Commit

Permalink
Fixed assertion in one failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmircea-orange committed Apr 26, 2015
1 parent cba53f7 commit 60051d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Bert.RateLimiters.Tests/FixedTokenBucketTests.cs
Expand Up @@ -102,16 +102,16 @@ public void ShouldThrottle_WhenCalledWithNGreaterThanMaxSleepNGreaterThanMax_Ret
TimeSpan waitTime;
var before = bucket.ShouldThrottle(N_GREATER_THAN_MAX, out waitTime);
var tokensBefore = bucket.CurrentTokenCount;
Assert.That(waitTime, Is.EqualTo(TimeSpan.FromMilliseconds(REFILL_INTERVAL * 1000)));
Assert.That(waitTime, Is.EqualTo(TimeSpan.FromSeconds(REFILL_INTERVAL)));
Assert.That(before, Is.True);
Assert.That(tokensBefore, Is.EqualTo(MAX_TOKENS));

SystemTime.SetCurrentTimeUtc = () => virtualNow.AddSeconds(REFILL_INTERVAL);
SystemTime.SetCurrentTimeUtc = () => virtualNow.AddSeconds(REFILL_INTERVAL+1);

var after = bucket.ShouldThrottle(N_GREATER_THAN_MAX, out waitTime);
var tokensAfter = bucket.CurrentTokenCount;
Assert.That(after, Is.True);
Assert.That(waitTime, Is.EqualTo(TimeSpan.Zero));
Assert.That(waitTime, Is.EqualTo(TimeSpan.FromSeconds(REFILL_INTERVAL-1)));
Assert.That(tokensAfter, Is.EqualTo(MAX_TOKENS));
}

Expand Down

0 comments on commit 60051d1

Please sign in to comment.