Skip to content

Migrate test projects to xUnit v3 mtp-2 with cooperative cancellation#316

Merged
damianh merged 11 commits intomainfrom
dh/mtp
Feb 16, 2026
Merged

Migrate test projects to xUnit v3 mtp-2 with cooperative cancellation#316
damianh merged 11 commits intomainfrom
dh/mtp

Conversation

@damianh
Copy link
Copy Markdown
Member

@damianh damianh commented Feb 8, 2026

Summary

  • Upgrade all test projects to xUnit v3 with Microsoft Testing Platform (MTP) support
  • Implement cooperative cancellation pattern across all async tests
  • Add [assembly: CaptureConsole] to capture console output in test results

Changes

  • xUnit v3 upgrade: Switch to xunit.v3.core.mtp-v2 for MTP integration
  • Cooperative cancellation: Add TestContext.Current.CancellationToken propagation to all async test methods
  • Console capture: Add [assembly: CaptureConsole] attribute to test assemblies

Test Projects Updated

  • AccessTokenManagement.Tests
  • IdentityModel.Tests
  • IdentityModel.OidcClient.Tests
  • OAuth2Introspection.Tests

Copilot AI review requested due to automatic review settings February 8, 2026 21:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates multiple test projects to xUnit v3 with Microsoft Testing Platform support, adds cooperative cancellation propagation, and enables console output capture in test results.

Changes:

  • Switch test infrastructure to xUnit v3 (xunit.v3.core.mtp-v2) and set test projects to executable output.
  • Propagate TestContext.Current.CancellationToken through async test calls.
  • Add [assembly: CaptureConsole] to test assemblies.

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test.props Updates shared test project props for MTP/xUnit v3 (exe output + package refs).
Directory.Packages.props Central package update to use xunit.v3.core.mtp-v2.
introspection/test/AspNetCore.Authentication.OAuth2Introspection.Tests/Introspection.cs Propagates cancellation token through HTTP calls in introspection tests.
introspection/test/AspNetCore.Authentication.OAuth2Introspection.Tests/Configuration.cs Propagates cancellation token through HTTP calls in configuration tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/UserInfoExtensionsTests.cs Propagates cancellation token through IdentityModel HTTP client extension tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/TokenRevocationExtensions.cs Propagates cancellation token through token revocation extension tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/TokenRequestExtensionsResponseTests.cs Propagates cancellation token through token response tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/TokenRequestExtensionsRequestTests.cs Propagates cancellation token through token request tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/TokenIntrospectionTests.cs Propagates cancellation token through introspection extension tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/PushedAuthorizationTests.cs Propagates cancellation token through PAR extension tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/JsonWebKeyExtensionsTests.cs Propagates cancellation token through JWKs extension tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/DynamicClientRegistrationTests.cs Propagates cancellation token through dynamic registration tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/DiscoveryExtensionsTests.cs Propagates cancellation token and adjusts discovery tests for v3/MTP.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/DeviceAuthorizationExtensionsTests.cs Propagates cancellation token through device authorization tests.
identity-model/test/IdentityModel.Tests/HttpClientExtensions/CibaExtensionsTests.cs Propagates cancellation token through CIBA extension tests.
identity-model/test/IdentityModel.Tests/DiscoveryPolicyTests_AuthorityUriComparison.cs Propagates cancellation token through discovery policy tests (URI strategy).
identity-model/test/IdentityModel.Tests/DiscoveryPolicyTests_AuthorityStringComparison.cs Propagates cancellation token through discovery policy tests (string strategy).
identity-model/test/IdentityModel.Tests/AssemblyInfo.cs Adds [assembly: CaptureConsole] for console capture.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/RefreshTokenDelegatingHandlerTests.cs Adds cancellation token wiring in OidcClient tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/OidcClientTests.cs Adds cancellation token wiring to OidcClient API calls.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/DPoP/DPoPTests.cs Adds cancellation token wiring to DPoP integration tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/ConfigurationTests.cs Uses cooperative cancellation token in provider info loading tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/CommonResponseTests.cs Adds cancellation token wiring to response processing tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/CodeFlowResponseTests.cs Adds cancellation token wiring throughout code flow response tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/AuthorizeRequestTests.cs Adds cancellation token wiring to authorize request tests.
identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/AssemblyInfo.cs Adds [assembly: CaptureConsole] for console capture.
access-token-management/test/AccessTokenManagement.Tests/UserTokenManagementWithDPoPTests.cs Propagates cancellation token through DPoP user-token integration tests.
access-token-management/test/AccessTokenManagement.Tests/UserTokenManagementTests.cs Propagates cancellation token through user token management integration tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRetrieverTests.cs Uses cooperative cancellation token in token retriever tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/UserAccessTokenTokenRequestCustomizerTests.cs Propagates cancellation token through token request customizer tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/ScenarioTests.cs Propagates cancellation token through scenario tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/RevokeRefreshTokenAsyncTests.cs Propagates cancellation token through revoke-refresh-token tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/GetUserAccessTokenAsyncTests.cs Propagates cancellation token through get-user-token tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/GetClientAccessTokenAsyncTests.cs Propagates cancellation token through get-client-token tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/ClientCredentialsTokenRequestCustomizerTests.cs Propagates cancellation token through client-credentials customizer tests.
access-token-management/test/AccessTokenManagement.Tests/TokenRequestCustomizer/ClientAccessTokenTokenRequestCustomizerTests.cs Propagates cancellation token through client-access-token customizer tests.
access-token-management/test/AccessTokenManagement.Tests/StoreTokensInAuthenticationPropertiesTests.cs Adds cancellation token propagation to token storage APIs.
access-token-management/test/AccessTokenManagement.Tests/HybridCacheExplorationTests.cs Adds cancellation token propagation to HybridCache calls.
access-token-management/test/AccessTokenManagement.Tests/ClientTokenManagementTests.cs Adds cancellation token propagation to client token manager tests.
access-token-management/test/AccessTokenManagement.Tests/ClientTokenManagementApiTests.cs Adds cancellation token propagation to API-level token management tests.
access-token-management/test/AccessTokenManagement.Tests/BackChannelClientTests.cs Adds cancellation token propagation to backchannel client tests.
access-token-management/test/AccessTokenManagement.Tests/AssemblyInfo.cs Adds [assembly: CaptureConsole] for console capture.
access-token-management/test/AccessTokenManagement.Tests/AccessTokenHandler/AccessTokenHandlerTests.cs Adds cancellation token propagation to access token handler tests.
Comments suppressed due to low confidence (1)

identity-model/test/IdentityModel.Tests/HttpClientExtensions/DiscoveryExtensionsTests.cs:1

  • This test no longer validates the stated behavior (“Authority should expand to endpoint”). Passing _endpoint as the Address bypasses authority-expansion logic and makes the test assert a trivial case. Restore an authority input (e.g., https://demo.identityserver.io) and keep _endpoint as the expected expanded request URI.
// Copyright (c) Duende Software. All rights reserved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@damianh damianh marked this pull request as draft February 8, 2026 21:39
@damianh damianh self-assigned this Feb 8, 2026
@damianh damianh added the area/foss Across all components. label Feb 8, 2026
@damianh damianh force-pushed the dh/mtp branch 2 times, most recently from b3a87a0 to 1b79113 Compare February 8, 2026 23:04
@damianh damianh requested a review from a team February 13, 2026 10:51
@damianh damianh marked this pull request as ready for review February 13, 2026 13:17
@damianh damianh changed the title Migrate test projects to xUnit v3 with cooperative cancellation Migrate test projects to xUnit v3 mtp-2 with cooperative cancellation Feb 16, 2026
The net481 test support was temporarily disabled in Oct 2025 and the commented-out code has since become incompatible with refactored method signatures. Remove the dead commented-out blocks from the workflow generator and clean up orphaned net481 conditional ItemGroups in IdentityModel.Tests.csproj.
@damianh
Copy link
Copy Markdown
Member Author

damianh commented Feb 16, 2026

We'll drop support for netstandard and running tests on windows hosts in a follow up PR.

@damianh damianh merged commit d3cc5fd into main Feb 16, 2026
8 checks passed
@damianh damianh deleted the dh/mtp branch February 16, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/foss Across all components.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants