-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Remove AwesomeAssertions from host tests (infrastructure only) #122938
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
| .CaptureStdErr() | ||
| .CaptureStdOut() | ||
| .Execute() | ||
| .Should().Fail() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please remove these Should combinators and use a simple imperative style, e.g.
var result = Command
```suggestion
var result = Command.Create(app.AppExe)
.CaptureStdErr()
.CaptureStdOut()
.Execute();
CommandAssert.Failed(result);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Converted all tests in InstallLocation.cs to imperative style:
- Replaced fluent
.Should()combinators with direct assertions - Changed extension methods to
Assert*pattern (e.g.,HaveUsedDotNetRootInstallLocation→AssertUsedDotNetRootInstallLocation) - All commands now store result in
var result = Command...Execute()followed by direct assertions
Commit: 82dae8a
…mbinators Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
…l used elsewhere Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
|
@copilot Please fix build errors |
… and extension files Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Working on build errors. Fixed most issues:
Still have 8 remaining compilation errors in Nethost.cs and SelfContainedAppLaunch.cs where method names need alignment. Continuing to fix... |
…hods Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
|
@copilot more errors |
… usage Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Fixed all remaining build errors in AppHost.Bundle.Tests:
All installer test projects now build successfully:
Commit: 9d81c89 |
|
@copilot test failures `failed HostActivation.Tests.InstallLocation.SearchOptions_AppRelative_MissingPath (12ms) |
…gex options Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Fixed both test failures:
Commit: 6ac8355 |
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Reverted all changes after ff354c4. The PR now only contains the initial infrastructure changes:
All subsequent commits (InstallLocation conversions, build error fixes, .And. removals, etc.) have been undone to simplify the PR scope. Commit: aa3c42c |
Description
Standardizes installer test infrastructure to use XUnit asserts directly instead of AwesomeAssertions/FluentAssertions, aligning with runtime testing conventions. This PR contains only the foundational infrastructure changes.
Changes
Package dependencies: Removed
AwesomeAssertionspackage reference fromsrc/installer/tests/TestUtils/TestUtils.csproj. Addedxunit.v3.asserttoTestUtils.csproj.Assertion infrastructure: Replaced FluentAssertions'
AssertionChain.ForCondition().FailWith()pattern withAssert.True(condition, message)inCommandResultAssertionsandDirectoryInfoAssertions. Changed return types fromAndConstraint<T>to direct typeTfor method chaining.Initial test file updates: Removed
using FluentAssertions;imports from initial test files includingCreateAppHost.cs,SigningTests.cs, and extension classes. Converted direct FluentAssertions usage (e.g.,.Should().Be(expected)) to XUnit equivalents (e.g.,Assert.Equal(expected, actual)).Scope
This PR has been scoped down to include only the infrastructure changes and initial test file updates. The conversion of remaining test files across the installer test suite will be handled in follow-up PRs to keep changes manageable and reviewable.
Customer Impact
None. Internal test infrastructure change only.
Regression
No. This is a test infrastructure modernization.
Testing
The infrastructure changes maintain backward compatibility with existing test patterns. Initial test files that were updated continue to function correctly with XUnit assertions.
Risk
Low. Changes are confined to test infrastructure. The assertion logic remains functionally equivalent, only the underlying API changed from FluentAssertions to XUnit. Remaining test files still use the fluent assertion style and will be migrated incrementally in subsequent PRs.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.