diff --git a/Directory.Packages.props b/Directory.Packages.props index 9c753941192..965a22d5bca 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ - + @@ -38,8 +38,9 @@ - + + diff --git a/eng/Test.targets b/eng/Test.targets index 4058f40c299..7d916c08284 100644 --- a/eng/Test.targets +++ b/eng/Test.targets @@ -18,8 +18,8 @@ - - + + diff --git a/src/Snippets/Snippets.csproj b/src/Snippets/Snippets.csproj index 788bae6a322..75c58f6df49 100644 --- a/src/Snippets/Snippets.csproj +++ b/src/Snippets/Snippets.csproj @@ -32,7 +32,7 @@ - + diff --git a/test/Polly.Core.Tests/Hedging/HedgingResilienceStrategyTests.cs b/test/Polly.Core.Tests/Hedging/HedgingResilienceStrategyTests.cs index f196b730cce..2c6b1aab850 100644 --- a/test/Polly.Core.Tests/Hedging/HedgingResilienceStrategyTests.cs +++ b/test/Polly.Core.Tests/Hedging/HedgingResilienceStrategyTests.cs @@ -3,7 +3,6 @@ using Polly.Hedging.Utils; using Polly.Telemetry; using Polly.Testing; -using Xunit.Abstractions; namespace Polly.Core.Tests.Hedging; diff --git a/test/Polly.Core.Tests/Polly.Core.Tests.csproj b/test/Polly.Core.Tests/Polly.Core.Tests.csproj index 5105ea208e1..e1216c4b1f2 100644 --- a/test/Polly.Core.Tests/Polly.Core.Tests.csproj +++ b/test/Polly.Core.Tests/Polly.Core.Tests.csproj @@ -7,6 +7,7 @@ enable 100 $(NoWarn);S6966 + Exe [Polly.Core]* true @@ -15,7 +16,7 @@ - + diff --git a/test/Polly.Core.Tests/ResiliencePipelineTests.cs b/test/Polly.Core.Tests/ResiliencePipelineTests.cs index c47604b7908..614c3f2ba14 100644 --- a/test/Polly.Core.Tests/ResiliencePipelineTests.cs +++ b/test/Polly.Core.Tests/ResiliencePipelineTests.cs @@ -11,7 +11,7 @@ public partial class ResiliencePipelineTests #pragma warning disable IDE0028 public static TheoryData ResilienceContextPools = new() { - null, + null as ResilienceContextPool, ResilienceContextPool.Shared, }; #pragma warning restore IDE0028 diff --git a/test/Polly.Core.Tests/Utils/Pipeline/PipelineComponentFactoryTests.cs b/test/Polly.Core.Tests/Utils/Pipeline/PipelineComponentFactoryTests.cs index 40eb7f2b26d..d708fce04f9 100644 --- a/test/Polly.Core.Tests/Utils/Pipeline/PipelineComponentFactoryTests.cs +++ b/test/Polly.Core.Tests/Utils/Pipeline/PipelineComponentFactoryTests.cs @@ -8,17 +8,17 @@ public class PipelineComponentFactoryTests #pragma warning disable IDE0028 public static TheoryData> EmptyCallbacks = new() { - Array.Empty(), + Array.Empty() as IEnumerable, Enumerable.Empty(), - new List(), - new EmptyActionEnumerable(), // Explicitly does not provide TryGetNonEnumeratedCount() + new List() as IEnumerable, + new EmptyActionEnumerable() as IEnumerable, // Explicitly does not provide TryGetNonEnumeratedCount() }; public static TheoryData> NonEmptyCallbacks = new() { - new[] { () => { } }, + new[] { () => { } } as IEnumerable, Enumerable.TakeWhile(Enumerable.Repeat(() => { }, 50), (_, i) => i < 1), // Defeat optimisation for TryGetNonEnumeratedCount() - new List { () => { } }, + new List { () => { } } as IEnumerable, }; #pragma warning restore IDE0028 diff --git a/test/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj b/test/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj index 344d5001a12..7e056b04d5d 100644 --- a/test/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj +++ b/test/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj @@ -5,6 +5,7 @@ Test enable 100 + Exe [Polly.Extensions]* diff --git a/test/Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj b/test/Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj index 88fd0658026..5b067743f37 100644 --- a/test/Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj +++ b/test/Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj @@ -5,6 +5,7 @@ Test enable 100 + Exe [Polly.RateLimiting]* diff --git a/test/Polly.Specs/Helpers/Bulkhead/AnnotatedOutputHelper.cs b/test/Polly.Specs/Helpers/Bulkhead/AnnotatedOutputHelper.cs index fa61f84806e..ee798da4aa7 100644 --- a/test/Polly.Specs/Helpers/Bulkhead/AnnotatedOutputHelper.cs +++ b/test/Polly.Specs/Helpers/Bulkhead/AnnotatedOutputHelper.cs @@ -29,6 +29,8 @@ public Item(string format, object[] args) private readonly ITestOutputHelper _innerOutputHelper; + public string Output => _innerOutputHelper.Output; + public AnnotatedOutputHelper(ITestOutputHelper innerOutputHelper) => _innerOutputHelper = innerOutputHelper ?? throw new ArgumentNullException(nameof(innerOutputHelper)); diff --git a/test/Polly.Specs/Helpers/Bulkhead/SilentOutputHelper.cs b/test/Polly.Specs/Helpers/Bulkhead/SilentOutputHelper.cs index 2aa50df2883..8c1aca5bba8 100644 --- a/test/Polly.Specs/Helpers/Bulkhead/SilentOutputHelper.cs +++ b/test/Polly.Specs/Helpers/Bulkhead/SilentOutputHelper.cs @@ -2,6 +2,18 @@ public class SilentOutputHelper : ITestOutputHelper { + public string Output => string.Empty; + + public void Write(string message) + { + // Do nothing: intentionally silent. + } + + public void Write(string format, params object[] args) + { + // Do nothing: intentionally silent. + } + public void WriteLine(string message) { // Do nothing: intentionally silent. diff --git a/test/Polly.Specs/Polly.Specs.csproj b/test/Polly.Specs/Polly.Specs.csproj index a7d836659d8..9666f6e824a 100644 --- a/test/Polly.Specs/Polly.Specs.csproj +++ b/test/Polly.Specs/Polly.Specs.csproj @@ -3,6 +3,7 @@ net10.0;net9.0;net8.0 $(TargetFrameworks);net481 enable + Exe Test 94,94,91 [Polly]* @@ -22,7 +23,6 @@ - diff --git a/test/Polly.Testing.Tests/Polly.Testing.Tests.csproj b/test/Polly.Testing.Tests/Polly.Testing.Tests.csproj index 646329abf83..4a6d4f0531c 100644 --- a/test/Polly.Testing.Tests/Polly.Testing.Tests.csproj +++ b/test/Polly.Testing.Tests/Polly.Testing.Tests.csproj @@ -5,6 +5,7 @@ Test enable 100 + Exe [Polly.Testing]* diff --git a/test/Shared/TestCancellation.cs b/test/Shared/TestCancellation.cs index be9cd8b0678..5396df4d754 100644 --- a/test/Shared/TestCancellation.cs +++ b/test/Shared/TestCancellation.cs @@ -1,6 +1,8 @@ +using Xunit; + namespace Polly; internal static class TestCancellation { - public static CancellationToken Token => CancellationToken.None; + public static CancellationToken Token => TestContext.Current.CancellationToken; }