コード例 #1
0
        public void CanTrace_DecimalQps()
        {
            var rateLimiter = TraceUtils.GetRateLimiter(0.1, new long[] { 9999, 10001 });

            Assert.False(rateLimiter.CanTrace());
            Assert.True(rateLimiter.CanTrace());
        }
コード例 #2
0
        public void CreateOptions_ShouldNotTrace()
        {
            var rateLimiter = TraceUtils.GetRateLimiter(999);
            var factory     = new RateLimitingTraceOptionsFactory(rateLimiter);

            Assert.False(factory.CreateOptions().ShouldTrace);
        }
コード例 #3
0
        public void CanTrace_Multiple()
        {
            var rateLimiter = TraceUtils.GetRateLimiter(
                1, new long[] { 999, 1001, 1790, 1850, 2030, 2700, 5000 });

            Assert.False(rateLimiter.CanTrace());
            Assert.True(rateLimiter.CanTrace());
            Assert.False(rateLimiter.CanTrace());
            Assert.False(rateLimiter.CanTrace());
            Assert.True(rateLimiter.CanTrace());
            Assert.False(rateLimiter.CanTrace());
            Assert.True(rateLimiter.CanTrace());
        }
コード例 #4
0
        public void CanTrace_False()
        {
            var rateLimiter = TraceUtils.GetRateLimiter(999);

            Assert.False(rateLimiter.CanTrace());
        }
コード例 #5
0
        public void CanTrace()
        {
            var rateLimiter = TraceUtils.GetRateLimiter(1001);

            Assert.True(rateLimiter.CanTrace());
        }