Bert.RateLimiters.Tests.RollingWindowThrottlerTests.ShouldThrottle_WhenCalledAfterSecondPassesAndAllows2PerSecond_WillReturnFalse C# (CSharp) Метод

ShouldThrottle_WhenCalledAfterSecondPassesAndAllows2PerSecond_WillReturnFalse() приватный Метод

        public void ShouldThrottle_WhenCalledAfterSecondPassesAndAllows2PerSecond_WillReturnFalse()
        {
            SystemTime.SetCurrentTimeUtc = () => referenceTime;
            var virtualNow = SystemTime.UtcNow;

            var throttler = new RollingWindowThrottler(2, TimeSpan.FromSeconds(1));
            long waitTimeMillis;
            var shouldThrottle = throttler.ShouldThrottle(1, out waitTimeMillis);
            shouldThrottle.ShouldBeFalse();

            SystemTime.SetCurrentTimeUtc = () => virtualNow.AddSeconds(1);
            shouldThrottle = throttler.ShouldThrottle(1, out waitTimeMillis);
            shouldThrottle.ShouldBeFalse();
            waitTimeMillis.ShouldEqual(0);
        }