Skip to content

test: address xUnit1051 warnings by passing TestContext.Current.CancellationToken (#473)#475

Merged
adrianhall merged 2 commits into
CommunityToolkit:mainfrom
adrianhall:issues/473
Jun 15, 2026
Merged

test: address xUnit1051 warnings by passing TestContext.Current.CancellationToken (#473)#475
adrianhall merged 2 commits into
CommunityToolkit:mainfrom
adrianhall:issues/473

Conversation

@adrianhall

Copy link
Copy Markdown
Collaborator

Closes #473

Thread TestContext.Current.CancellationToken into test method calls that accept a CancellationToken so tests cancel responsively, resolving ~700 xUnit1051 analyzer warnings across all affected test projects.

No test logic or assertions changed beyond threading the cancellation token, with two mechanical exceptions required to keep the code compiling:

  • GenericAuthenticationProvider.GetTokenAsync uses a named argument (cancellationToken:) because the token is the second optional parameter.
  • OfflineDbContext.PullAsync empty-list call casts [] to IEnumerable to avoid overload ambiguity once the token is supplied.

ahall added 2 commits June 15, 2026 12:14
…llationToken (CommunityToolkit#473)

Thread TestContext.Current.CancellationToken into test method calls that accept a CancellationToken so tests cancel responsively, resolving ~700 xUnit1051 analyzer warnings across all affected test projects.

No test logic or assertions changed beyond threading the cancellation token, with two mechanical exceptions required to keep the code compiling:
- GenericAuthenticationProvider.GetTokenAsync uses a named argument (cancellationToken:) because the token is the second optional parameter.
- OfflineDbContext.PullAsync empty-list call casts [] to IEnumerable<Type> to avoid overload ambiguity once the token is supplied.
@adrianhall adrianhall merged commit ce6a4c9 into CommunityToolkit:main Jun 15, 2026
5 checks passed
@adrianhall adrianhall deleted the issues/473 branch June 15, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address xUnit1051 analyzer warnings (pass TestContext.Current.CancellationToken)

1 participant