public void NewObject_SetsCountToOneWithExpiration()
{
// Arrange
var key = new SimpleThrottleKey("test", "key");
var limiter = new Limiter()
.Limit(1)
.Over(100);
var cache = new MemoryCache("testing_cache");
var repository = new MemoryThrottleRepository(cache);
repository.CurrentDate = () => new DateTime(2030, 1, 1);
string id = repository.CreateThrottleKey(key, limiter);
// Act
repository.AddOrIncrementWithExpiration(key, limiter);
// Assert
var item = (MemoryThrottleRepository.ThrottleCacheItem)cache.Get(id);
Assert.Equal(1L, item.Count);
// We're testing a future date by 100 seconds which is 40 seconds + 1 minute
Assert.Equal(new DateTime(2030, 1, 1, 0, 1, 40), item.Expiration);
}