Beispiel #1
0
        public void Create_FixedWindow()
        {
            var options   = new FixedWindowRateLimiterOptions(1, QueueProcessingOrder.OldestFirst, 10, TimeSpan.FromMinutes(1), true);
            var partition = RateLimitPartition.CreateFixedWindowLimiter(1, key => options);

            var limiter            = partition.Factory(1);
            var fixedWindowLimiter = Assert.IsType <FixedWindowRateLimiter>(limiter);

            Assert.Equal(options.PermitLimit, fixedWindowLimiter.GetAvailablePermits());
            Assert.Equal(options.Window, fixedWindowLimiter.ReplenishmentPeriod);
            Assert.False(fixedWindowLimiter.IsAutoReplenishing);
        }