public async Task PolicyExecutesThePassedDelegate() { bool executed = false; RateLimiterAsyncPolicy <int> policy = RateLimiterAsyncPolicy <int> .Create(2, TimeSpan.FromSeconds(30)); await policy.ExecuteAsync(() => { executed = true; return(Task.FromResult(0)); }); executed.Should().BeTrue(); }
public async Task PolicyExecutesThePassedDelegate() { bool executed = false; RateLimiterAsyncPolicy policy = RateLimiterAsyncPolicy.Create(1, TimeSpan.FromSeconds(10)); await policy.ExecuteAsync(() => { executed = true; return(Task.CompletedTask); }); executed.Should().BeTrue(); }