Skip to content

Apply structured assertion messages (RFC 012) to AreEqual / AreNotEqual (delta overloads)#8336

Merged
Evangelink merged 5 commits into
mainfrom
dev/amauryleve/rfc012-numerics-areequal-delta
May 19, 2026
Merged

Apply structured assertion messages (RFC 012) to AreEqual / AreNotEqual (delta overloads)#8336
Evangelink merged 5 commits into
mainfrom
dev/amauryleve/rfc012-numerics-areequal-delta

Conversation

@Evangelink

@Evangelink Evangelink commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Migrate numeric delta Assert.AreEqual / Assert.AreNotEqual overload failures (float/double/decimal/long) to RFC 012 structured assertion messages.
  • Add delta-specific structured summary resources and regenerate XLF files.
  • Update unit tests for the new structured messages, including interpolated-string handler paths and expected/actual text coverage.

Touched files (behavioral vs. supporting)

Behavioral scope (limited to numeric delta overloads):

  • src/TestFramework/TestFramework/Assertions/Assert.AreEqual.Numerics.cs

Supporting / mechanical changes (no behavioral change to other APIs):

  • src/TestFramework/TestFramework/Assertions/Assert.cs — helpers reused by the new structured delta path.
  • Interpolated-string handler plumbing for the delta overloads.
  • src/TestFramework/TestFramework/Resources/FrameworkMessages.resx + xlf/*.xlf — new delta structured-summary resources.
  • test/UnitTests/TestFramework.UnitTests/Assertions/AssertTests.AreEqual*.cs — updated expectations.

Failure messages now use StructuredAssertionMessage, EvidenceBlock, AssertionValueRenderer, and call-site expressions with a <delta> placeholder, matching RFC 012. String/collection/Assert.That APIs remain out of scope for this PR.

Validation

  • dotnet clean src\TestFramework\TestFramework\TestFramework.csproj -c Release -nologo -v:minimal
  • dotnet build src\TestFramework\TestFramework\TestFramework.csproj -c Release -nologo -v:minimal
  • dotnet build test\UnitTests\TestFramework.UnitTests\TestFramework.UnitTests.csproj -c Release -f net9.0 -p:GenerateBuildInfo=false -nologo -v:minimal (blocked by unrelated pre-existing PlatformVersion generation failure in src/Platform/Microsoft.Testing.Platform/Hosts/ServerTestHost.cs)

Reference: RFC 012 structured assertion messages.

…al (delta overloads)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 18, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 migrates numeric delta Assert.AreEqual / Assert.AreNotEqual failures to structured assertion messages and updates resources/tests around assertion output. It also includes broader string assertion resource/test updates and localized XLF regeneration.

Changes:

  • Adds structured evidence/call-site rendering for numeric delta assertion failures.
  • Updates interpolated-string handler paths for delta overloads.
  • Updates FrameworkMessages resources, localized XLF files, and unit-test expectations.
Show a summary per file
File Description
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.Numerics.cs Implements structured messages for numeric delta failures.
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.InterpolatedStringHandlers.cs Routes delta interpolated-string handlers through structured failure helpers.
src/TestFramework/TestFramework/Resources/FrameworkMessages.resx Adds/updates assertion summary and string-difference resources.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.cs.xlf Updates Czech localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.de.xlf Updates German localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.es.xlf Updates Spanish localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.fr.xlf Updates French localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.it.xlf Updates Italian localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.ja.xlf Updates Japanese localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.ko.xlf Updates Korean localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.pl.xlf Updates Polish localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.pt-BR.xlf Updates Portuguese localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.ru.xlf Updates Russian localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.tr.xlf Updates Turkish localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.zh-Hans.xlf Updates Simplified Chinese localized resource entries.
src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.zh-Hant.xlf Updates Traditional Chinese localized resource entries.
test/UnitTests/TestFramework.UnitTests/Assertions/AssertTests.AreEqualTests.cs Updates assertion-message expectations and delta structured-message coverage.

Copilot's findings

  • Files reviewed: 17/17 changed files
  • Comments generated: 16

Comment thread src/TestFramework/TestFramework/Resources/FrameworkMessages.resx
Comment thread src/TestFramework/TestFramework/Resources/FrameworkMessages.resx Outdated
Comment thread src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.de.xlf Outdated
Comment thread src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.es.xlf Outdated
Comment thread src/TestFramework/TestFramework/Resources/xlf/FrameworkMessages.zh-Hans.xlf Outdated
Comment thread src/TestFramework/TestFramework/Resources/FrameworkMessages.resx
@Evangelink

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>

Copilot AI commented May 19, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 53f3cf7 by merging main into this branch and fixing the conflicted assertion handler/XLF files.

…s, regenerate XLFs, drop dead helpers

- Removed AreNotUnorderedEquivalentFailedSummary, AreUnorderedEquivalentDifferenceSummary, and AreUnorderedEquivalentFailedSummary from FrameworkMessages.resx; they were not referenced by any code in this PR.
- Ran UpdateXlf to drop the stale AreEqualDeltaFailMsg / AreNotEqualDeltaFailMsg entries from all localized XLFs (the resx renamed these to *FailedSummary).
- Removed the now-unused private helpers BuildUserMessageForExpectedExpressionAndActualExpression / BuildUserMessageForNotExpectedExpressionAndActualExpression / BuildUserMessageForTwoExpressions in Assert.cs (the delta migration removed their only callers; IDE0051 was failing the build).
- Reshaped CreateDeltaAreEqualFailureMessage / CreateDeltaAreNotEqualFailureMessage in AssertTests.AreEqualTests.cs to use collection expressions (IDE0300).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 19, 2026 09:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 18/18 changed files
  • Comments generated: 2

Comment thread src/TestFramework/TestFramework/Assertions/Assert.cs
Copilot AI and others added 2 commits May 19, 2026 12:30
Picks up new AssertThatFailedToEvaluate trans-unit from #8307 across all locales.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink merged commit e3aaafb into main May 19, 2026
47 of 50 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/rfc012-numerics-areequal-delta branch May 19, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants