Apply structured assertion messages (RFC 012) to Assert.IComparable family#8260
Merged
Conversation
…amily Migrates Assert.IsGreaterThan / IsGreaterThanOrEqualTo / IsLessThan / IsLessThanOrEqualTo / IsPositive / IsNegative to the structured assertion message format defined in RFC 012. The bound comparisons use 'lower bound:' / 'upper bound:' labels next to 'actual:'. The IsPositive / IsNegative assertions use 'expected: > 0' / 'expected: < 0' for symmetry with how WithExpectedAndActual is consumed by AssertFailedException.ExpectedText / ActualText. Removes the now-unused BuildUserMessageForLowerBoundExpression* / UpperBoundExpression* / ValueExpression helpers from Assert.cs (the call-site is now reconstructed via FormatCallSiteExpression). Updates the affected tests in AssertTests.IComparableTests.cs to match the new message layout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Continues the RFC 012 rollout by migrating the Assert IComparable family (IsGreaterThan, IsGreaterThanOrEqualTo, IsLessThan, IsLessThanOrEqualTo, IsPositive, IsNegative) to the structured assertion message format.
Changes:
- Replaced legacy single-line
Report*Failedhelpers withReportComparisonFailed/ReportSignFailedthat build aStructuredAssertionMessage(summary, evidence block, expected/actual metadata, and call-site expression). - Added six
*FailedSummaryresource entries (FrameworkMessages.resx+ all.xlffiles updated viaUpdateXlf). - Removed now-unused
BuildUserMessageForLowerBound/UpperBound/ValueExpressionhelpers, consolidated NaN handling forIsPositive/IsNegativeinto a singleorpattern, and updatedAssertTests.IComparableTestsexpectations.
Show a summary per file
| File | Description |
|---|---|
| src/TestFramework/TestFramework/Assertions/Assert.IComparable.cs | Rewires the six assertions to use the structured message helpers. |
| src/TestFramework/TestFramework/Assertions/Assert.cs | Removes now-unused BuildUserMessageFor* helpers. |
| src/TestFramework/TestFramework/Resources/FrameworkMessages.resx | Adds six *FailedSummary resource strings. |
| src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.*.xlf | Regenerated XLFs for the new resource entries. |
| test/UnitTests/TestFramework.UnitTests/Assertions/AssertTests.IComparableTests.cs | Updates the six *ShouldThrowWithMessage tests to the new layout. |
Copilot's findings
- Files reviewed: 17/17 changed files
- Comments generated: 0
Evangelink
commented
May 15, 2026
Member
Author
Evangelink
left a comment
There was a problem hiding this comment.
Review Summary — PR #8260 (Assert.IComparable → RFC 012 structured messages)
| # | Dimension | Verdict |
|---|---|---|
| 1 | Algorithmic Correctness | ✅ LGTM (bonus: pre-existing "Assert.IsLessThan" typo in IsLessThanOrEqualTo reporter fixed) |
| 2 | Threading & Concurrency | ✅ N/A |
| 3 | Security & IPC Contract Safety | ✅ N/A |
| 4 | Public API & Binary Compatibility | ✅ LGTM |
| 5 | Performance & Allocations | ✅ LGTM |
| 6 | Cross-TFM Compatibility | ✅ LGTM |
| 7 | Resource & IDisposable Management | ✅ N/A |
| 8 | Defensive Coding at Boundaries | ✅ LGTM |
| 9 | Localization & Resources | 🟡 1 MODERATE |
| 10 | Test Isolation | ✅ LGTM |
| 11 | Assertion Quality | ✅ LGTM |
| 12 | Flakiness Patterns | ✅ LGTM |
| 13 | Test Completeness & Coverage | ✅ LGTM |
| 14 | Data-Driven Test Coverage | ✅ LGTM |
| 15 | Code Structure & Simplification | ✅ LGTM |
| 16 | Naming & Conventions | ✅ LGTM |
| 17 | Documentation Accuracy | ✅ LGTM |
| 18 | Analyzer & Code Fix Quality | ✅ N/A |
| 19 | IPC Wire Compatibility | ✅ N/A |
| 20 | Build Infrastructure & Dependencies | ✅ LGTM |
| 21 | Scope & PR Discipline | ✅ LGTM |
✅ 19/21 dimensions clean (2 N/A).
Finding
- [MODERATE] Orphaned resource keys in
FrameworkMessages.resx— The six oldIs*FailMsgkeys (IsGreaterThanFailMsg,IsGreaterThanOrEqualToFailMsg,IsLessThanFailMsg,IsLessThanOrEqualToFailMsg,IsPositiveFailMsg,IsNegativeFailMsg) are still present in the.resxand all XLF locale files even though no code references them any longer. Translators will be asked to localize dead strings. Remove these entries (.resx+ all XLF trans-units) before merging.
Generated by Expert Code Review (on open) for issue #8260 · ● 29.6M
This was referenced May 15, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Contributor
Resolved. I merged |
Copilot AI
added a commit
that referenced
this pull request
May 16, 2026
…icts with IComparable RFC 012 (#8260) Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
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.
Continues the rollout of RFC 012 — Structured Assertion Messages by migrating the
AssertIComparable family to the structured-message format. Follows the patterns established by previously merged work (#8170, #8187, #8210, #8214) and the in-flight #8258 (StartsWith/EndsWith) and #8259 (MatchesRegex/DoesNotMatchRegex).Migrates:
Assert.IsGreaterThan,Assert.IsGreaterThanOrEqualTo,Assert.IsLessThan,Assert.IsLessThanOrEqualTo,Assert.IsPositive,Assert.IsNegative.Output format
Assert.IsGreaterThan(10, 5, ""A Message""):Assert.IsLessThanOrEqualTo(5, 10, ""A Message""):Assert.IsPositive(-5, ""A Message""):Notes
IsGreaterThanFailedSummary/IsGreaterThanOrEqualToFailedSummary/IsLessThanFailedSummary/IsLessThanOrEqualToFailedSummary/IsPositiveFailedSummary/IsNegativeFailedSummaryresource entries (XLF files regenerated viaUpdateXlf).BuildUserMessageForLowerBoundExpression*/BuildUserMessageForUpperBoundExpression*/BuildUserMessageForValueExpressionhelpers fromAssert.cs.AssertTests.IComparableTests.csto assert against the new layout.Validation
dotnet build src/TestFramework/TestFramework/TestFramework.csproj -c Debug— clean.dotnet test test/UnitTests/TestFramework.UnitTests/TestFramework.UnitTests.csproj -c Debug— 3535/3535 passed.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com