Move ErrorUtilities_Tests to Assumed_Tests - #14141
Merged
JanProvaznik merged 1 commit intoJun 24, 2026
Merged
Conversation
ErrorUtilities_Tests.cs tested Assumed.True APIs, not ErrorUtilities. Consolidate these tests into Assumed_Tests.cs in Framework.UnitTests, updating from xUnit Assert to Shouldly and adding coverage for: - True(bool, string?) with a non-null message (both passing and failing) - Lazy evaluation of the TrueInterpolatedStringHandler: verifies the interpolated string is not formatted when the condition is true, is formatted when false, and formats multiple args correctly Remove ErrorUtilities_Tests.cs and its <Compile> links from Build.UnitTests, Tasks.UnitTests, and Utilities.UnitTests.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates tests that were validating Assumed.True behavior (including interpolated string handler laziness) by moving them out of ErrorUtilities_Tests.cs into Framework.UnitTests’s Assumed_Tests.cs, and removes the now-misleading shared test file and its compile links from other test projects.
Changes:
- Move/merge
Assumed.True-focused tests intosrc/Framework.UnitTests/Assumed_Tests.cs, updating assertions to Shouldly and expanding interpolated-string-handler coverage. - Delete
src/Shared/UnitTests/ErrorUtilities_Tests.cs(which wasn’t testingErrorUtilities) and remove<Compile Include=...>links from multiple unit test projects. - Keep the shared unit test projects clean by avoiding redundant/incorrectly-scoped shared test files.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Framework.UnitTests/Assumed_Tests.cs | Adds/hosts the migrated Assumed.True tests and new interpolated-string-handler laziness scenarios. |
| src/Shared/UnitTests/ErrorUtilities_Tests.cs | Removes the miscategorized shared test file. |
| src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj | Removes the shared compile include for the deleted test file. |
| src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj | Removes the shared compile include for the deleted test file. |
| src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj | Removes the shared compile include for the deleted test file. |
Comments suppressed due to low confidence (1)
src/Framework.UnitTests/Assumed_Tests.cs:106
- PR description says to add coverage for Assumed.True(bool, string?) with a non-null message in both passing and failing cases. The passing case was added, but there's no test verifying the custom message is included in the thrown InternalErrorException when the condition is false (this coverage was previously in ErrorUtilities_Tests).
[Fact]
public void True_DoesNotThrow_WithMessage_WhenTrue()
{
Assumed.True(true, "msbuild rules");
}
[Fact]
public void True_Throws_WhenFalse()
{
Should.Throw<InternalErrorException>(() => Assumed.True(false));
}
AR-May
approved these changes
Jun 24, 2026
JanProvaznik
approved these changes
Jun 24, 2026
This was referenced Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ErrorUtilities_Tests.cs tested Assumed.True APIs, not ErrorUtilities. Consolidate these tests into Assumed_Tests.cs in Framework.UnitTests, updating from xUnit Assert to Shouldly and adding coverage for:
Remove ErrorUtilities_Tests.cs and its links from Build.UnitTests, Tasks.UnitTests, and Utilities.UnitTests.