Skip to content

fix: failure messages of EquivalencyComparer#751

Merged
vbreuss merged 2 commits intomainfrom
topic/fix-equivalencycomparer-failure-messages
Sep 3, 2025
Merged

fix: failure messages of EquivalencyComparer#751
vbreuss merged 2 commits intomainfrom
topic/fix-equivalencycomparer-failure-messages

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Sep 3, 2025

This PR fixes failure messages in the EquivalencyComparer by changing "equivalent to" to "equivalent for" in negated scenarios, and improves test coverage for the Exceptions HasParamName functionality.

Key Changes

  • Fixed failure message wording in EquivalencyComparer for negated equivalency checks
  • Added comprehensive test coverage for negated HasParamName scenarios
  • Enhanced HasParamName implementation to properly handle null expected values in different grammar contexts

Also improve code coverage for Exceptions `HasParamName`
@vbreuss vbreuss self-assigned this Sep 3, 2025
Copilot AI review requested due to automatic review settings September 3, 2025 08:54
@vbreuss vbreuss added the bug Something isn't working label Sep 3, 2025
Copy link
Copy Markdown

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 fixes failure messages in the EquivalencyComparer by changing "equivalent to" to "equivalent for" in negated scenarios, and improves test coverage for the Exceptions HasParamName functionality.

Key Changes

  • Fixed failure message wording in EquivalencyComparer for negated equivalency checks
  • Added comprehensive test coverage for negated HasParamName scenarios
  • Enhanced HasParamName implementation to properly handle null expected values in different grammar contexts

Reviewed Changes

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

Show a summary per file
File Description
Tests/aweXpect.Tests/ThatGeneric.DoesNotComplyWith.Tests.cs Updated expected error messages to use "equivalent for" instead of "equivalent to"
Tests/aweXpect.Tests/Objects/ThatObject.IsNotOneOf.Tests.cs Updated expected error messages to use "equivalent for" instead of "equivalent to"
Tests/aweXpect.Tests/Objects/ThatObject.IsNotEquivalentTo.Tests.cs Updated expected error messages to use "equivalent for" instead of "equivalent to"
Tests/aweXpect.Tests/Objects/ThatObject.IsEquivalentTo.Tests.cs Added new test cases for IEqualityComparer scenarios and negated equivalency tests
Tests/aweXpect.Tests/Exceptions/ThatException.HasParamName.Tests.cs Added comprehensive test coverage for negated HasParamName scenarios
Tests/aweXpect.Internal.Tests/ThatTests/Exceptions/HasParamNameValueConstraintTests.cs Added unit tests for HasParamName expectation message formatting
Source/aweXpect/That/Exceptions/ThatException.HasParamName.cs Enhanced implementation to handle null expected values and different grammar contexts
Source/aweXpect/Equivalency/EquivalencyComparer.cs Fixed failure message wording and improved formatting for IEqualityComparer scenarios
Source/aweXpect.Core/Core/Polyfills/ReferenceEqualityComparer.cs Added ExcludeFromCodeCoverage attribute

Comment thread Tests/aweXpect.Tests/Objects/ThatObject.IsEquivalentTo.Tests.cs Outdated
Comment thread Source/aweXpect/Equivalency/EquivalencyComparer.cs
Comment thread Source/aweXpect/Equivalency/EquivalencyComparer.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vbreuss vbreuss enabled auto-merge (squash) September 3, 2025 08:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 3, 2025

Test Results

    14 files   - 24      14 suites   - 24   4m 17s ⏱️ +36s
17 310 tests + 9  17 307 ✅ + 9  3 💤 ±0  0 ❌ ±0 
48 585 runs   -  3  48 580 ✅  -  3  5 💤 ±0  0 ❌ ±0 

Results for commit 5797bd6. ± Comparison against base commit ec4efe1.

This pull request removes 1557 and adds 1566 tests. Note that renamed tests count towards both.
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message1501bcca-3208-41bd-a02b-ad0cd5a07db9")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message78363fd1-f20d-4697-9e29-2bcc2ec13a6b")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messagea3047807-d60b-4f46-9290-3993d088e967")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message328199e1-5449-4b5e-a771-8bb380af78f1")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message5d7e734e-c0d2-4201-9788-8e77d4bb20a7")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagef8e72766-5e69-478e-9f17-d0654d214f67")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore258adbf5-0d2a-4e60-806d-58f78fe39cb3")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore65ab76c4-77ae-4179-8f5d-7473e7804f71")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore9cb8c1c7-8447-43c3-aba6-74ca597553cb")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason808d150c-5d8f-4b6c-9de4-f409a568c65e")
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message3be241d1-8869-48f3-ac73-e27fed37dd94")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message9c394d6b-8d2a-40a1-a9e1-66f2cc671e20")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messaged5563195-f718-49dd-bfe6-60e31b733ebd")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagec41fb292-f19c-4ff6-90c1-df81c5969a97")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagec524e92c-ae7b-411f-bedf-1e6759d5204f")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagef8251c59-c5db-478e-a400-4879210aec89")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore181a9e7a-d3e0-40e4-9648-724db3b1ac9a")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnore9d5f449f-3e97-4104-9483-b2496870b604")
aweXpect.Core.Tests.Equivalency.EquivalencyOptionsExtensionsTests ‑ Generic_For_IgnoringMember_ShouldSetOptionForType(memberToIgnore: "memberToIgnorec66c33cf-ce1b-47d4-8c5c-c4e938c09fc2")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason4c3b15f6-c6ba-4632-b27a-a1e6d8695f1b")
…

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 3, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.413
[Host] : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 208.6 ns 1.39 ns 1.16 ns 0.0300 - 504 B
Bool_FluentAssertions 239.4 ns 0.93 ns 0.87 ns 0.0567 - 952 B
Bool_TUnit 857.6 ns 7.23 ns 6.41 ns 0.1431 - 2408 B
Equivalency_aweXpect 326,104.5 ns 3,191.79 ns 2,985.60 ns 16.6016 0.4883 285044 B
Equivalency_FluentAssertions 2,121,569.6 ns 3,937.07 ns 3,287.63 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 687,923.7 ns 2,421.66 ns 2,022.20 ns 51.7578 2.9297 880545 B
Int_GreaterThan_aweXpect 247.8 ns 1.59 ns 1.41 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 241.8 ns 1.84 ns 1.73 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 1,199.3 ns 3.78 ns 3.54 ns 0.1774 - 2984 B
ItemsCount_AtLeast_aweXpect 476.0 ns 0.97 ns 0.76 ns 0.0868 - 1464 B
ItemsCount_AtLeast_FluentAssertions 489.7 ns 0.96 ns 0.85 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 14,996.0 ns 138.53 ns 129.58 ns 1.6327 - 27480 B
String_aweXpect 429.4 ns 4.41 ns 4.12 ns 0.0734 - 1232 B
String_FluentAssertions 479.3 ns 11.37 ns 10.63 ns 0.1292 - 2168 B
String_TUnit 1,308.6 ns 18.26 ns 17.08 ns 0.1831 - 3072 B
StringArray_aweXpect 1,944.8 ns 14.89 ns 13.93 ns 0.1678 - 2856 B
StringArray_FluentAssertions 1,463.2 ns 5.63 ns 5.27 ns 0.2480 - 4152 B
StringArray_TUnit 3,470.6 ns 11.12 ns 9.86 ns 0.3128 - 5296 B
StringArrayInAnyOrder_aweXpect 2,397.3 ns 3.81 ns 3.18 ns 0.1793 - 3048 B
StringArrayInAnyOrder_FluentAssertions 156,387.4 ns 289.77 ns 256.87 ns 3.4180 - 64324 B
StringArrayInAnyOrder_TUnit 4,217.6 ns 13.16 ns 12.31 ns 0.3815 - 6488 B

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 3, 2025

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Equivalency/EquivalencyComparer.cs 89.29% 50 2 0 4 11 9 50 6 76
That/Exceptions/ThatException.HasParamName.cs 100.00% 43 0 0 0 21 19 43 0 83

The final mutation score is 93.94%

Coverage Thresholds: high:80 low:60 break:0

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

@vbreuss vbreuss merged commit a18e70c into main Sep 3, 2025
13 of 14 checks passed
@vbreuss vbreuss deleted the topic/fix-equivalencycomparer-failure-messages branch September 3, 2025 09:06
github-actions Bot added a commit that referenced this pull request Sep 3, 2025
github-actions Bot added a commit that referenced this pull request Sep 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 9, 2025

This is addressed in release v2.23.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants