diff --git a/Polly8Study.Test/Polly8RetryStrategyTest.cs b/Polly8Study.Test/Polly8RetryStrategyTest.cs new file mode 100644 index 0000000..bfeb32a --- /dev/null +++ b/Polly8Study.Test/Polly8RetryStrategyTest.cs @@ -0,0 +1,42 @@ +namespace Polly8Study.Test +{ + /// <summary> + /// Polly8��ʱ���� ���� + /// �ؼ��� + /// CancellationToken��û������Dz���ʹ�õ� + /// ����֮ǰ�汾�е��ֹ۳�ʱ�����۳�ʱò��ȡ���� + /// </summary> + public class Polly8RetryStrategyTest + { + private readonly ITestOutputHelper _output; + + public Polly8RetryStrategyTest(ITestOutputHelper testOutput) + { + _output = testOutput; + } + + /// <summary> + /// ���Բ��� + /// </summary> + [Fact] + public void Test() + { + ResiliencePipeline pipeline = new ResiliencePipelineBuilder() + .AddRetry(new RetryStrategyOptions + { + ShouldHandle = new Polly.PredicateBuilder().Handle<Exception>(), + Delay = TimeSpan.FromSeconds(1), + MaxRetryAttempts = 3, + BackoffType = DelayBackoffType.Constant + }) + .Build(); // After all necessary strategies are added, call Build() to create the pipeline. + + // Synchronous execution + pipeline.Execute(static () => + { + // Your code goes here + }); + } + + } +} \ No newline at end of file