Fix test to be deterministic (#315)

This commit is contained in:
Adam Hathcock
2025-05-30 13:30:57 +01:00
committed by GitHub
parent 68ace02e2d
commit b652ffa773
@@ -66,9 +66,14 @@ public class AdditionalCancellationTests
cancellationSource.Cancel();
foreach (var task in tasks)
while (tasks.Count != 0)
{
await Assert.ThrowsAsync<OperationCanceledException>(async () => await task);
await Assert.ThrowsAsync<OperationCanceledException>(async () =>
{
var t = await Task.WhenAny(tasks);
tasks.Remove(t);
await t;
});
}
cancellationSource.IsCancellationRequested.Should().BeTrue();
}