diff --git a/test/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs b/test/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs index f8ad898390..67682fb64c 100644 --- a/test/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs +++ b/test/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs @@ -1,13 +1,8 @@ namespace Polly.Specs.Bulkhead; -[Collection(Helpers.Constants.ParallelThreadDependentTestCollection)] -public class BulkheadAsyncSpecs : BulkheadSpecsBase +[Collection(Constants.ParallelThreadDependentTestCollection)] +public class BulkheadAsyncSpecs(ITestOutputHelper testOutputHelper) : BulkheadSpecsBase(testOutputHelper) { - public BulkheadAsyncSpecs(ITestOutputHelper testOutputHelper) - : base(testOutputHelper) - { - } - #region Configuration [Fact] @@ -59,7 +54,7 @@ public async Task Should_call_onBulkheadRejected_with_passed_context() { _ = Task.Run(() => { bulkhead.ExecuteAsync(async () => { await tcs.Task; }); }); - Within(CohesionTimeLimit, () => BulkheadSpecsBase.Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); + Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); await bulkhead.Awaiting(b => b.ExecuteAsync(_ => TaskHelper.EmptyTask, contextPassedToExecute)).Should().ThrowAsync(); diff --git a/test/Polly.Specs/Bulkhead/BulkheadSpecs.cs b/test/Polly.Specs/Bulkhead/BulkheadSpecs.cs index c2de650c4c..44b3912c82 100644 --- a/test/Polly.Specs/Bulkhead/BulkheadSpecs.cs +++ b/test/Polly.Specs/Bulkhead/BulkheadSpecs.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.Bulkhead; -[Collection(Helpers.Constants.ParallelThreadDependentTestCollection)] +[Collection(Constants.ParallelThreadDependentTestCollection)] public class BulkheadSpecs : BulkheadSpecsBase { public BulkheadSpecs(ITestOutputHelper testOutputHelper) @@ -59,7 +59,7 @@ public void Should_call_onBulkheadRejected_with_passed_context() Task.Run(() => { bulkhead.Execute(() => { tcs.Task.Wait(); }); }); // Time for the other thread to kick up and take the bulkhead. - Within(CohesionTimeLimit, () => BulkheadSpecsBase.Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); + Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); bulkhead.Invoking(b => b.Execute(_ => { }, contextPassedToExecute)).Should() .Throw(); diff --git a/test/Polly.Specs/Bulkhead/BulkheadSpecsBase.cs b/test/Polly.Specs/Bulkhead/BulkheadSpecsBase.cs index 53131c9efb..b20fbd9eb2 100644 --- a/test/Polly.Specs/Bulkhead/BulkheadSpecsBase.cs +++ b/test/Polly.Specs/Bulkhead/BulkheadSpecsBase.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.Bulkhead; -[Collection(Helpers.Constants.ParallelThreadDependentTestCollection)] +[Collection(Constants.ParallelThreadDependentTestCollection)] public abstract class BulkheadSpecsBase : IDisposable { #region Time constraints diff --git a/test/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs b/test/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs index 9a47626d39..6ab0eda9f3 100644 --- a/test/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs +++ b/test/Polly.Specs/Bulkhead/BulkheadTResultAsyncSpecs.cs @@ -66,7 +66,7 @@ public async Task Should_call_onBulkheadRejected_with_passed_context() }); }); - Within(CohesionTimeLimit, () => BulkheadSpecsBase.Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); + Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); await bulkhead.Awaiting(b => b.ExecuteAsync(_ => Task.FromResult(1), contextPassedToExecute)).Should().ThrowAsync(); diff --git a/test/Polly.Specs/Bulkhead/BulkheadTResultSpecs.cs b/test/Polly.Specs/Bulkhead/BulkheadTResultSpecs.cs index 426cab7d9a..129e298162 100644 --- a/test/Polly.Specs/Bulkhead/BulkheadTResultSpecs.cs +++ b/test/Polly.Specs/Bulkhead/BulkheadTResultSpecs.cs @@ -66,7 +66,7 @@ public void Should_call_onBulkheadRejected_with_passed_context() }); }); - Within(CohesionTimeLimit, () => BulkheadSpecsBase.Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); + Within(CohesionTimeLimit, () => Expect(0, () => bulkhead.BulkheadAvailableCount, nameof(bulkhead.BulkheadAvailableCount))); bulkhead.Invoking(b => b.Execute(_ => 1, contextPassedToExecute)).Should().Throw(); diff --git a/test/Polly.Specs/RateLimit/AsyncRateLimitPolicySpecs.cs b/test/Polly.Specs/RateLimit/AsyncRateLimitPolicySpecs.cs index 39dfdc7d92..85d2b1dc41 100644 --- a/test/Polly.Specs/RateLimit/AsyncRateLimitPolicySpecs.cs +++ b/test/Polly.Specs/RateLimit/AsyncRateLimitPolicySpecs.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.RateLimit; -[Collection(Polly.Specs.Helpers.Constants.SystemClockDependentTestCollection)] +[Collection(Constants.SystemClockDependentTestCollection)] public class AsyncRateLimitPolicySpecs : RateLimitPolicySpecsBase, IDisposable { public void Dispose() => diff --git a/test/Polly.Specs/RateLimit/AsyncRateLimitPolicyTResultSpecs.cs b/test/Polly.Specs/RateLimit/AsyncRateLimitPolicyTResultSpecs.cs index 48a19d03ee..00bbe74121 100644 --- a/test/Polly.Specs/RateLimit/AsyncRateLimitPolicyTResultSpecs.cs +++ b/test/Polly.Specs/RateLimit/AsyncRateLimitPolicyTResultSpecs.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.RateLimit; -[Collection(Polly.Specs.Helpers.Constants.SystemClockDependentTestCollection)] +[Collection(Constants.SystemClockDependentTestCollection)] public class AsyncRateLimitPolicyTResultSpecs : RateLimitPolicyTResultSpecsBase, IDisposable { public void Dispose() => diff --git a/test/Polly.Specs/RateLimit/RateLimitPolicySpecs.cs b/test/Polly.Specs/RateLimit/RateLimitPolicySpecs.cs index b98bc1af9f..eb7329856e 100644 --- a/test/Polly.Specs/RateLimit/RateLimitPolicySpecs.cs +++ b/test/Polly.Specs/RateLimit/RateLimitPolicySpecs.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.RateLimit; -[Collection(Polly.Specs.Helpers.Constants.SystemClockDependentTestCollection)] +[Collection(Constants.SystemClockDependentTestCollection)] public class RateLimitPolicySpecs : RateLimitPolicySpecsBase, IDisposable { public void Dispose() => diff --git a/test/Polly.Specs/RateLimit/RateLimitPolicySpecsBase.cs b/test/Polly.Specs/RateLimit/RateLimitPolicySpecsBase.cs index 913fe22c2a..448d6e65b5 100644 --- a/test/Polly.Specs/RateLimit/RateLimitPolicySpecsBase.cs +++ b/test/Polly.Specs/RateLimit/RateLimitPolicySpecsBase.cs @@ -295,7 +295,7 @@ public void Given_immediate_parallel_contention_ratelimiter_still_only_permits_o // Act - release gate. gate.Set(); #pragma warning disable S6603 - RateLimitSpecsBase.Within(TimeSpan.FromSeconds(10 /* high to allow for slow-running on time-slicing CI servers */), () => tasks.All(t => t.IsCompleted).Should().BeTrue()); + Within(TimeSpan.FromSeconds(10 /* high to allow for slow-running on time-slicing CI servers */), () => tasks.All(t => t.IsCompleted).Should().BeTrue()); #pragma warning restore S6603 // Assert - one should have permitted execution, n-1 not. diff --git a/test/Polly.Specs/RateLimit/RateLimitPolicyTResultSpecs.cs b/test/Polly.Specs/RateLimit/RateLimitPolicyTResultSpecs.cs index 4368863794..d94142b748 100644 --- a/test/Polly.Specs/RateLimit/RateLimitPolicyTResultSpecs.cs +++ b/test/Polly.Specs/RateLimit/RateLimitPolicyTResultSpecs.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.RateLimit; -[Collection(Polly.Specs.Helpers.Constants.SystemClockDependentTestCollection)] +[Collection(Constants.SystemClockDependentTestCollection)] public class RateLimitPolicyTResultSpecs : RateLimitPolicyTResultSpecsBase, IDisposable { public void Dispose() => diff --git a/test/Polly.Specs/RateLimit/TokenBucketRateLimiterTestsBase.cs b/test/Polly.Specs/RateLimit/TokenBucketRateLimiterTestsBase.cs index 4d18d3f6f9..18aa01a3a9 100644 --- a/test/Polly.Specs/RateLimit/TokenBucketRateLimiterTestsBase.cs +++ b/test/Polly.Specs/RateLimit/TokenBucketRateLimiterTestsBase.cs @@ -1,6 +1,6 @@ namespace Polly.Specs.RateLimit; -[Collection(Polly.Specs.Helpers.Constants.SystemClockDependentTestCollection)] +[Collection(Constants.SystemClockDependentTestCollection)] public abstract class TokenBucketRateLimiterTestsBase : RateLimitSpecsBase, IDisposable { internal abstract IRateLimiter GetRateLimiter(TimeSpan onePer, long bucketCapacity); @@ -194,7 +194,7 @@ public void Given_immediate_parallel_contention_ratelimiter_still_only_permits_o // Act - release gate. gate.Set(); #pragma warning disable S6603 - RateLimitSpecsBase.Within(TimeSpan.FromSeconds(10 /* high to allow for slow-running on time-slicing CI servers */), () => tasks.All(t => t.IsCompleted).Should().BeTrue()); + Within(TimeSpan.FromSeconds(10 /* high to allow for slow-running on time-slicing CI servers */), () => tasks.All(t => t.IsCompleted).Should().BeTrue()); #pragma warning restore S6603 // Assert - one should have permitted execution, n-1 not. diff --git a/test/Polly.Specs/Timeout/TimeoutSpecs.cs b/test/Polly.Specs/Timeout/TimeoutSpecs.cs index 898ca34eb5..1aa47d3587 100644 --- a/test/Polly.Specs/Timeout/TimeoutSpecs.cs +++ b/test/Polly.Specs/Timeout/TimeoutSpecs.cs @@ -271,7 +271,7 @@ public void Should_rethrow_aggregate_exception_from_inside_delegate__pessimistic // Check to see if nested aggregate exceptions are unwrapped correctly AggregateException exception = new AggregateException(msg, new NotImplementedException()); - policy.Invoking(p => p.Execute(() => { TimeoutSpecsBase.Helper_ThrowException(exception); })) + policy.Invoking(p => p.Execute(() => { Helper_ThrowException(exception); })) .Should().Throw() .WithMessage(exception.Message) .Where(e => e.InnerException is NotImplementedException) diff --git a/test/Polly.Specs/Timeout/TimeoutTResultSpecs.cs b/test/Polly.Specs/Timeout/TimeoutTResultSpecs.cs index c73e1a057a..c8beb31a8f 100644 --- a/test/Polly.Specs/Timeout/TimeoutTResultSpecs.cs +++ b/test/Polly.Specs/Timeout/TimeoutTResultSpecs.cs @@ -262,7 +262,7 @@ public void Should_rethrow_aggregate_exception_from_inside_delegate__pessimistic // Check to see if nested aggregate exceptions are unwrapped correctly AggregateException exception = new AggregateException(msg, new NotImplementedException()); - policy.Invoking(p => p.Execute(() => { TimeoutSpecsBase.Helper_ThrowException(exception); return ResultPrimitive.WhateverButTooLate; })) + policy.Invoking(p => p.Execute(() => { Helper_ThrowException(exception); return ResultPrimitive.WhateverButTooLate; })) .Should().Throw() .WithMessage(exception.Message) .Where(e => e.InnerException is NotImplementedException) @@ -278,7 +278,7 @@ public void Should_rethrow_aggregate_exception_with_multiple_exceptions_from_ins Exception innerException1 = new NotImplementedException(); Exception innerException2 = new DivideByZeroException(); AggregateException aggregateException = new AggregateException(msg, innerException1, innerException2); - Func func = () => { TimeoutSpecsBase.Helper_ThrowException(aggregateException); return ResultPrimitive.WhateverButTooLate; }; + Func func = () => { Helper_ThrowException(aggregateException); return ResultPrimitive.WhateverButTooLate; }; // Whether executing the delegate directly, or through the policy, exception behavior should be the same. func.Should().Throw()