Example #1
0
        public void Should_Be_NonIdempotent_When_NonIdempotentRule(string methodPattern, string pathPattern)
        {
            iclCache.GetAsync()
            .Returns(
                new List <IdempotencyControlRule>(
                    new[]
            {
                new IdempotencyControlRule
                {
                    Method       = methodPattern,
                    IsIdempotent = false,
                    PathPattern  = new Wildcard(pathPattern)
                }
            }));

            iclResolver.IsIdempotentAsync(POST, FooPath).GetAwaiter().GetResult().Should().BeFalse();
        }
Example #2
0
        public void Should_Be_Idempotent_When_NoRules()
        {
            var iclRulesProvider = Substitute.For <IIclRulesSettingsProvider>();

            iclRulesProvider.GetAsync().Returns(new IdempotencySettings());
            var iclCache = new IclCache(iclRulesProvider);

            var iclResolver = new IclResolver(iclCache);

            iclResolver.IsIdempotentAsync(POST, FooPath).GetAwaiter().GetResult().Should().BeTrue();
        }
 public async Task <bool> IsIdempotentAsync(string method, string path)
 {
     return(await blackListIdempotencyResolver.IsIdempotent(method, path).ConfigureAwait(false) && await iclResolver.IsIdempotentAsync(method, path).ConfigureAwait(false));
 }