Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure AD B2Cサンプルをxunit v3に移行する #2547

Merged

Conversation

tsuna-can-se
Copy link
Contributor

この Pull request で実施したこと

Azure AD B2CサンプルをxUnit v3に移行しました。
コードカバレッジの取得ツールを coverlet.collector から Microsoft.Testing.Extensions.CodeCoverage に変更しました。
カバレッジ取得ツールの変更にあわせてワークフローを修正しました。

この Pull request では実施していないこと

なし

Issues や Discussions 、関連する Web サイトなどへのリンク

なし

`Directory.Packages.props`ファイルから`xunit`と`xunit.abstractions`を削除し、`xunit.v3`を追加しました。バージョンは`2.9.3`から`2.0.0`に変更されています。

`Dressca.IntegrationTest.csproj`ファイルでも同様に`xunit`を削除し、`xunit.v3`を追加しました。これにより、テストフレームワークが最新のバージョンに更新されました。
`ApiTest.cs`のテストメソッドでHTTPリクエストを送信する際に、キャンセルトークンを追加しました。これにより、リクエストがキャンセル可能になり、テストの柔軟性が向上しました。具体的には、`GetAsync`メソッドの呼び出しに`cancellationToken`を渡すように変更され、認証が必要なAPIおよび認証不要なAPIの両方でリクエストがキャンセルできるようになりました。
`ApiTestWebApplicationFactory.cs`ファイル内の`ApiTestWebApplicationFactory<TProgram>`クラスに、`ConfigurationBuilder`を使用してアプリケーションの設定を構築するコードを追加しました。これにより、現在のディレクトリを基準に`appsettings.json`ファイルを読み込み、オプションとして設定を再読み込みできるようになります。
Dressca.slnに"tests"プロジェクトセクションを追加し、Directory.Build.propsをソリューションアイテムとして指定しました。Directory.Build.propsには、テストプロジェクト用のプロパティとXunitの使用が定義されました。
@tsuna-can-se tsuna-can-se added CI/CD Github Actionsなどの修正 target: Azure AD B2C Auth Azure AD B2C認証の要件別サンプルに関係がある labels Mar 25, 2025
@tsuna-can-se tsuna-can-se self-assigned this Mar 25, 2025
@Copilot Copilot bot review requested due to automatic review settings March 25, 2025 11:07
@tsuna-can-se tsuna-can-se added this to the v1.1.0 milestone Mar 25, 2025
Copy link

@Copilot 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

This pull request migrates the Azure AD B2C sample to xUnit v3 and switches the code coverage tool from coverlet.collector to Microsoft.Testing.Extensions.CodeCoverage while updating the related CI workflow.

  • Updated the GitHub workflow to use new test and coverage commands.
  • Modified API tests to incorporate cancellation tokens and update endpoint references.
  • Removed an unused using statement and cleaned up formatting in the test factory.

Reviewed Changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated no comments.

File Description
.github/workflows/samples-azure-ad-b2c-auth-ci.yml Updated test execution and coverage reporting steps in the CI workflow to support the new tools and configurations.
samples/AzureADB2CAuth/auth-backend/tests/Dressca.IntegrationTest/ApiTest.cs Revised API tests to add cancellation tokens to HTTP requests and update endpoint references.
samples/AzureADB2CAuth/auth-backend/tests/Dressca.IntegrationTest/ApiTestWebApplicationFactory.cs Removed an extraneous blank line to clean up the file.
Files not reviewed (4)
  • samples/AzureADB2CAuth/auth-backend/Directory.Packages.props: Language not supported
  • samples/AzureADB2CAuth/auth-backend/Dressca.sln: Language not supported
  • samples/AzureADB2CAuth/auth-backend/tests/Directory.Build.props: Language not supported
  • samples/AzureADB2CAuth/auth-backend/tests/Dressca.IntegrationTest/Dressca.IntegrationTest.csproj: Language not supported
Comments suppressed due to low confidence (1)

samples/AzureADB2CAuth/auth-backend/tests/Dressca.IntegrationTest/ApiTest.cs:53

  • The API endpoint was updated from 'api/servertime' to 'api/serverTime'; please confirm that this change matches the intended backend routing.
var response = await client.GetAsync("api/serverTime", cancellationToken);

@tsuna-can-se tsuna-can-se requested a review from fkoyama March 25, 2025 11:11
@tsuna-can-se tsuna-can-se linked an issue Mar 25, 2025 that may be closed by this pull request
@fkoyama fkoyama merged commit 6b21c97 into main Mar 26, 2025
7 checks passed
@fkoyama fkoyama deleted the feature/AzureADB2Cサンプルをxunit-v3に移行する branch March 26, 2025 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD Github Actionsなどの修正 target: Azure AD B2C Auth Azure AD B2C認証の要件別サンプルに関係がある
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xUnit v3への移行(AzureADB2Cサンプル)
2 participants