Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the xunit group with 1 update #1769

Merged
merged 5 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageVersion Include="System.Threading.RateLimiting" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit" Version="2.6.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net6.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,16 @@ public async Task Disposed_EnsureThrows()
Assert.Throws<ObjectDisposedException>(() => controller.LastException);
Assert.Throws<ObjectDisposedException>(() => controller.LastHandledOutcome);

await Assert.ThrowsAsync<ObjectDisposedException>(async () => await controller.CloseCircuitAsync(ResilienceContextPool.Shared.Get()));
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await controller.IsolateCircuitAsync(ResilienceContextPool.Shared.Get()));
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await controller.OnActionPreExecuteAsync(ResilienceContextPool.Shared.Get()));
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await controller.OnActionSuccessAsync(Outcome.FromResult(10), ResilienceContextPool.Shared.Get()));
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await controller.OnActionFailureAsync(Outcome.FromResult(10), ResilienceContextPool.Shared.Get()));
// xunit 2.6.0 has Func<ValueTask> and Func<Task> overloads that cause ambiguity which
// is messy to resolve for multiple different TFMs, so force the Task version to be used.
static async Task AssertThrowsObjectDisposedExceptionAsync(Func<Task> func)
=> await Assert.ThrowsAsync<ObjectDisposedException>(func);

await AssertThrowsObjectDisposedExceptionAsync(async () => await controller.CloseCircuitAsync(ResilienceContextPool.Shared.Get()));
await AssertThrowsObjectDisposedExceptionAsync(async () => await controller.IsolateCircuitAsync(ResilienceContextPool.Shared.Get()));
await AssertThrowsObjectDisposedExceptionAsync(async () => await controller.OnActionPreExecuteAsync(ResilienceContextPool.Shared.Get()));
await AssertThrowsObjectDisposedExceptionAsync(async () => await controller.OnActionSuccessAsync(Outcome.FromResult(10), ResilienceContextPool.Shared.Get()));
await AssertThrowsObjectDisposedExceptionAsync(async () => await controller.OnActionFailureAsync(Outcome.FromResult(10), ResilienceContextPool.Shared.Get()));
Comment on lines +108 to +117
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in #1774.

}

[Fact]
Expand Down Expand Up @@ -193,7 +198,9 @@ public async Task OnActionFailure_EnsureLock()
var executeAction2 = Task.Run(() => controller.OnActionFailureAsync(Outcome.FromResult(0), ResilienceContextPool.Shared.Get()));

// assert
#pragma warning disable xUnit1031 // Do not use blocking task operations in test method
executeAction.Wait(50).Should().BeFalse();
#pragma warning restore xUnit1031 // Do not use blocking task operations in test method
verified.Set();
await executeAction;
await executeAction2;
Expand Down Expand Up @@ -412,7 +419,9 @@ public async Task ExecuteScheduledTask_Async_Ok()
var source = new TaskCompletionSource<string>();
var task = CircuitStateController<string>.ExecuteScheduledTaskAsync(source.Task, ResilienceContextPool.Shared.Get().Initialize<string>(isSynchronous: false)).AsTask();

#pragma warning disable xUnit1031 // Do not use blocking task operations in test method
task.Wait(3).Should().BeFalse();
#pragma warning restore xUnit1031 // Do not use blocking task operations in test method
task.IsCompleted.Should().BeFalse();

source.SetResult("ok");
Expand Down