Skip to content

Switch to AwesomeAssertions #113425

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

Merged
merged 2 commits into from
Mar 17, 2025
Merged

Switch to AwesomeAssertions #113425

merged 2 commits into from
Mar 17, 2025

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Mar 12, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings March 12, 2025 17:42
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 12, 2025
Copy link
Contributor

@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 PR switches the assertions in the test projects to use the new AssertionChain pattern provided by AwesomeAssertions. The key changes include:

  • Replacing Execute.Assertion calls with AssertionChain.ForCondition in various test assertions.
  • Updating constructors and extension methods to accept and forward an AssertionChain instance.
  • Adjusting a FluentAssertions numeric check in CommandResultExtensions.

Reviewed Changes

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

Show a summary per file
File Description
src/installer/tests/HostActivation.Tests/DependencyResolution/DependencyResolutionCommandResultExtensions.cs Updated assertion calls to utilize AssertionChain.
src/installer/tests/TestUtils/Assertions/DirectoryInfoExtensions.cs Updated DirectoryInfoExtensions to pass a new AssertionChain instance.
src/installer/tests/TestUtils/Assertions/DirectoryInfoAssertions.cs Modified constructor and assertion calls to use AssertionChain.
src/installer/tests/TestUtils/Assertions/CommandResultAssertions.cs Refactored assertions to use a CurrentAssertionChain property.
src/libraries/Microsoft.Extensions.DependencyModel/tests/JsonAssetions.cs Updated JsonAssertions to accept and use AssertionChain.
src/installer/tests/TestUtils/Assertions/CommandResultExtensions.cs Changed creation of CommandResultAssertions and updated a numeric assertion method.

@ericstj ericstj requested review from a team March 12, 2025 18:01
@kasperk81
Copy link
Contributor

another option is to run the migrator tool https://github.com/amoerie/fluentassertions-migrator and convert to xunit assert (like the rest of the tests in this repo)

@ericstj
Copy link
Member Author

ericstj commented Mar 17, 2025

/ba-g remaining failure is browser-wasm timeout

@ericstj
Copy link
Member Author

ericstj commented Mar 17, 2025

another option is to run the migrator tool https://github.com/amoerie/fluentassertions-migrator and convert to xunit assert (like the rest of the tests in this repo)

That's a fair suggestion. @dotnet/area-dependencymodel @dotnet/appmodel please consider this for the future.

@ericstj ericstj merged commit 96b80da into dotnet:main Mar 17, 2025
155 of 157 checks passed
@teo-tsirpanis teo-tsirpanis added area-Meta and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants