Skip to content

Commit

Permalink
Ignore AsyncTestSyncContext
Browse files Browse the repository at this point in the history
  • Loading branch information
pengweiqhca committed Jan 5, 2025
1 parent ca28cf2 commit fe4d6f3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Xunit.DependencyInjection.Test.Parallelization;
using Xunit.Sdk;

namespace Xunit.DependencyInjection.Test.Parallelization;

public class ConcurrencyFixture
{
Expand All @@ -21,7 +23,7 @@ public async Task<int> CheckConcurrencyAsync()
static ValueTask Delay(int millisecondsDelay)
{
// xunit 2.8.0+ and `parallelAlgorithm` is not `aggressive`
if (SynchronizationContext.Current == null)
if (SynchronizationContext.Current is null or not AsyncTestSyncContext)
return new(Task.Delay(millisecondsDelay));

// xunit lt 2.8.0+ or `parallelAlgorithm` is `aggressive`
Expand Down

0 comments on commit fe4d6f3

Please sign in to comment.