Skip to content

Commit

Permalink
Kill mutant (#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Jul 14, 2023
1 parent 5d16fe2 commit 802820b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void Dispose()
_disposed = true;
}

private static async ValueTask ExecuteScheduledTaskAsync(Task? task, ResilienceContext context)
internal static async ValueTask ExecuteScheduledTaskAsync(Task? task, ResilienceContext context)
{
if (task is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,21 @@ public async Task Flow_Closed_HalfOpen_Open_HalfOpen_Closed()
controller.CircuitState.Should().Be(CircuitState.Closed);
}

[Fact]
public async Task ExecuteScheduledTask_Async_Ok()
{
var source = new TaskCompletionSource<string>();
var task = CircuitStateController<string>.ExecuteScheduledTaskAsync(source.Task, ResilienceContext.Get().Initialize<string>(isSynchronous: false)).AsTask();

task.Wait(3).Should().BeFalse();
task.IsCompleted.Should().BeFalse();

source.SetResult("ok");

await task;
task.IsCompleted.Should().BeTrue();
}

private static DateTimeOffset? GetBlockedTill(CircuitStateController<int> controller) =>
(DateTimeOffset?)controller.GetType().GetField("_blockedUntil", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(controller)!;

Expand Down

0 comments on commit 802820b

Please sign in to comment.