Skip to content

feat: improve test output for dictionary ContainsKey#835

Merged
vbreuss merged 4 commits intomainfrom
topic/improve-dictionary-containskey-output
Nov 8, 2025
Merged

feat: improve test output for dictionary ContainsKey#835
vbreuss merged 4 commits intomainfrom
topic/improve-dictionary-containskey-output

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Nov 8, 2025

This PR improves test output consistency by adding "Expected" values to error messages across string and collection assertions. The main focus is making dictionary ContainsKey error messages clearer by replacing verbose dictionary dumps with concise expected key displays, and standardizing all string comparison error messages to show both actual and expected values.

Key Changes:

  • Replaced verbose dictionary context with expected key display in ContainsKey assertions
  • Added expected value output to all string comparison error messages
  • Updated test expectations to reflect the new error message format

@vbreuss vbreuss self-assigned this Nov 8, 2025
Copilot AI review requested due to automatic review settings November 8, 2025 21:47
@vbreuss vbreuss added the enhancement New feature or request label Nov 8, 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 improves test output consistency by adding "Expected" values to error messages across string and collection assertions. The main focus is making dictionary ContainsKey error messages clearer by replacing verbose dictionary dumps with concise expected key displays, and standardizing all string comparison error messages to show both actual and expected values.

Key Changes:

  • Replaced verbose dictionary context with expected key display in ContainsKey assertions
  • Added expected value output to all string comparison error messages
  • Updated test expectations to reflect the new error message format

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Source/aweXpect/That/Collections/ThatDictionary.ContainsKey.cs Conditional collection context based on outcome
Source/aweXpect/That/Collections/ThatReadOnlyDictionary.ContainsKey.cs Conditional collection context based on outcome
Source/aweXpect/That/Strings/ThatString.IsEqualTo.cs Added expected value to error context
Tests/aweXpect.Tests/Collections/ThatDictionary.ContainsKey.Tests.cs Updated test expectations to show expected key instead of dictionary
Tests/aweXpect.Tests/Collections/ThatReadOnlyDictionary.ContainsKey.Tests.cs Updated test expectations to show expected key instead of dictionary
Tests/aweXpect.Tests/Collections/ThatEnumerable.All.ComplyWith.Tests.cs Added System.Linq import
Tests/aweXpect.Tests/Strings/ThatString.StartsWith.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.AsWildcardTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.AsRegexTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.AsWildcardTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.AsSuffixTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.AsRegexTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.AsPrefixTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/ExpectTests.cs Added expected values to multi-assertion test expectations
Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.WhichTests.cs Added expected value to error message expectations
Tests/aweXpect.Tests/Delegates/ThatDelegate.Throws.WhichTests.cs Added expected value to error message expectations

Comment thread Source/aweXpect/That/Collections/ThatDictionary.ContainsKey.cs Outdated
Comment thread Source/aweXpect/That/Collections/ThatReadOnlyDictionary.ContainsKey.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 8, 2025 21:50
…nsKey.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Comment thread Source/aweXpect/That/Collections/ThatDictionary.ContainsKey.cs
@vbreuss vbreuss enabled auto-merge (squash) November 8, 2025 21:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 8, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.4, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.61GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.415
[Host] : .NET 8.0.21 (8.0.21, 8.0.2125.47513), X64 RyuJIT x86-64-v3

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 275.0 ns 0.97 ns 0.86 ns 0.0424 - 712 B
Bool_FluentAssertions 241.3 ns 2.47 ns 2.19 ns 0.0567 - 952 B
Equivalency_aweXpect 301,635.5 ns 3,557.76 ns 3,327.93 ns 20.0195 0.4883 335372 B
Equivalency_FluentAssertions 2,574,930.0 ns 22,219.88 ns 20,784.49 ns 285.1563 46.8750 4804906 B
Int_GreaterThan_aweXpect 242.0 ns 1.16 ns 1.08 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 243.4 ns 1.85 ns 1.73 ns 0.0730 - 1224 B
ItemsCount_AtLeast_aweXpect 453.6 ns 2.65 ns 2.48 ns 0.0772 - 1296 B
ItemsCount_AtLeast_FluentAssertions 471.8 ns 4.14 ns 3.88 ns 0.1197 - 2008 B
String_aweXpect 392.1 ns 1.95 ns 1.82 ns 0.0629 - 1056 B
String_FluentAssertions 1,179.2 ns 8.08 ns 7.56 ns 0.2346 - 3944 B
StringArray_aweXpect 1,813.7 ns 6.40 ns 5.67 ns 0.1526 - 2568 B
StringArray_FluentAssertions 1,296.3 ns 14.63 ns 13.68 ns 0.2480 - 4152 B
StringArrayInAnyOrder_aweXpect 2,353.6 ns 8.83 ns 7.82 ns 0.1640 - 2760 B
StringArrayInAnyOrder_FluentAssertions 87,241.4 ns 889.51 ns 832.05 ns 3.4180 - 58137 B

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 8, 2025

Test Results

    14 files   - 27      14 suites   - 27   4m 56s ⏱️ + 1m 5s
17 958 tests  - 26  17 956 ✅  - 26  2 💤 ±0  0 ❌ ±0 
50 511 runs   - 81  50 509 ✅  - 81  2 💤 ±0  0 ❌ ±0 

Results for commit 2e60b1a. ± Comparison against base commit 3125a53.

This pull request removes 1580 and adds 1554 tests. Note that renamed tests count towards both.
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message01e4a3e9-9b5a-42fd-93ee-4262a16422e6")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message6217f9ab-f6c9-44a8-9da1-9ceb6857fc92")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message674d7144-a131-489d-8f17-d30f69ebbdc7")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message33851c40-3c2f-4b5c-b8ac-7ea9e8ec6776")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message39285032-8490-46a1-bd11-000fab4002ad")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message80f8029e-b011-481c-a350-f344909211fc")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason41eed2cc-f7eb-49ba-abab-7c776449b0b5")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason8032ee9f-b312-4284-a579-1d12560295f7")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason80e31d65-96e7-493f-8a49-88025968cd5f")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reason4f09c94e-884f-43ac-a06a-472261951905")
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message569bc6ab-29ae-4a48-9592-e83a3093eb70")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message99733ffa-6891-4ec1-8523-778e797cfe39")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messagee0b02ca5-929b-404f-8119-18e3c5bf8400")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message38e41d3b-bdba-498a-9e14-074608b86f64")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message482a9984-4c14-4a01-8bef-934f7e60725c")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message53e6e266-5c9c-4dfa-b19a-39563d70d126")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason58296296-89cf-401e-b63d-9731dd63b9ad")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasonab08e799-b88b-477c-8b40-84ab2e4959fc")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasonde41c609-6b4f-42f8-ab58-7d8d495c5ece")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reason32a03bcc-49c5-495e-940e-42bc4421c8f1")
…

@vbreuss vbreuss merged commit 4999d0a into main Nov 8, 2025
10 of 12 checks passed
@vbreuss vbreuss deleted the topic/improve-dictionary-containskey-output branch November 8, 2025 21:59
github-actions Bot added a commit that referenced this pull request Nov 8, 2025
github-actions Bot added a commit that referenced this pull request Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message for dictionary

2 participants