Esempio n. 1
0
        public virtual async Task Check_Limit_Test_Async()
        {
            var context = new RequiresLimitFeatureContext(TestFeatureNames.TestLimitFeature, Options, LimitPolicy.Minute, 1, 5);
            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await Assert.ThrowsAsync <AbpAuthorizationException>(async() =>
            {
                await RequiresLimitFeatureChecker.CheckAsync(context);
            });

            Thread.Sleep(61000);
            // it's ok
            await RequiresLimitFeatureChecker.ProcessAsync(context);
        }
        public virtual async Task Check_Limit_Test_Async()
        {
            var context = new RequiresLimitFeatureContext(TestFeatureNames.TestLimitFeature, Options, LimitPolicy.Minute, 1, 5);
            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            await RequiresLimitFeatureChecker.ProcessAsync(context);

            var current = await RequiresLimitFeatureChecker.CheckAsync(context);

            current.ShouldBeFalse();

            Thread.Sleep(61000);
            // it's ok
            var nowCheckResult = await RequiresLimitFeatureChecker.CheckAsync(context);

            nowCheckResult.ShouldBeTrue();
        }
Esempio n. 3
0
 public virtual async Task Check_Test_Async()
 {
     var context = new RequiresLimitFeatureContext(TestFeatureNames.TestLimitFeature, Options, LimitPolicy.Minute);
     await RequiresLimitFeatureChecker.CheckAsync(context);
 }