Skip to content

fix: use list in ResultContexts#837

Merged
vbreuss merged 2 commits intomainfrom
topic/use-list-in-resultcontexts
Nov 9, 2025
Merged

fix: use list in ResultContexts#837
vbreuss merged 2 commits intomainfrom
topic/use-list-in-resultcontexts

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Nov 9, 2025

This PR refactors the ResultContexts class from using a custom linked-list implementation to using a standard List<ResultContext>. This simplification removes the internal _next field from ResultContext and replaces manual linked-list operations with built-in list methods. The changes also update test expectations to reflect improved error message formatting that now includes both "Actual" and "Expected" sections.

Key Changes

  • Replaced custom linked-list implementation in ResultContexts with List<ResultContext>
  • Removed internal _next field from ResultContext class
  • Added test case to verify the same context can be added multiple times

@vbreuss vbreuss self-assigned this Nov 9, 2025
Copilot AI review requested due to automatic review settings November 9, 2025 07:17
@vbreuss vbreuss added the bug Something isn't working label Nov 9, 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 refactors the ResultContexts class from using a custom linked-list implementation to using a standard List<ResultContext>. This simplification removes the internal _next field from ResultContext and replaces manual linked-list operations with built-in list methods. The changes also update test expectations to reflect improved error message formatting that now includes both "Actual" and "Expected" sections.

Key Changes

  • Replaced custom linked-list implementation in ResultContexts with List<ResultContext>
  • Removed internal _next field from ResultContext class
  • Added test case to verify the same context can be added multiple times

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Source/aweXpect.Core/Core/ResultContexts.cs Replaces linked-list implementation with List<ResultContext> for simpler collection management
Source/aweXpect.Core/Core/ResultContext.cs Removes internal _next field no longer needed after linked-list removal
Tests/aweXpect.Core.Tests/Core/ResultContextsTests.cs Adds test for adding same context multiple times to verify list-based implementation
Tests/aweXpect.Core.Tests/Options/StringEqualityOptionsTests.WildcardMatchTypeTests.cs Updates test expectations to include "Expected" section in error messages
Tests/aweXpect.Core.Tests/Options/StringEqualityOptionsTests.RegexMatchTypeTests.cs Updates test expectations to include "Expected" section in error messages
Tests/aweXpect.Core.Tests/Options/StringEqualityOptionsTests.ExactMatchTypeTests.cs Updates test expectations to include "Expected" section in error messages
Tests/aweXpect.Core.Tests/Customization/CustomizeFormattingTests.cs Updates test expectations to include "Expected" section in error messages
Tests/aweXpect.Core.Tests/Core/Nodes/WhichNodeTests.cs Updates test expectations to include "Expected" section in error messages

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Nov 9, 2025

@vbreuss vbreuss enabled auto-merge (squash) November 9, 2025 07:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 9, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.66GHz, 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 246.2 ns 2.00 ns 1.87 ns 0.0424 - 712 B
Bool_FluentAssertions 235.0 ns 2.51 ns 1.96 ns 0.0567 - 952 B
Equivalency_aweXpect 310,196.3 ns 909.07 ns 850.34 ns 20.0195 0.4883 335372 B
Equivalency_FluentAssertions 2,574,390.3 ns 11,492.46 ns 9,596.72 ns 285.1563 46.8750 4804906 B
Int_GreaterThan_aweXpect 292.6 ns 3.19 ns 2.98 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 241.1 ns 3.28 ns 2.74 ns 0.0730 - 1224 B
ItemsCount_AtLeast_aweXpect 441.1 ns 3.74 ns 3.31 ns 0.0772 - 1296 B
ItemsCount_AtLeast_FluentAssertions 484.1 ns 5.16 ns 4.58 ns 0.1192 - 2008 B
String_aweXpect 394.9 ns 1.75 ns 1.64 ns 0.0629 - 1056 B
String_FluentAssertions 1,162.4 ns 5.14 ns 4.81 ns 0.2346 - 3944 B
StringArray_aweXpect 1,817.4 ns 10.79 ns 9.57 ns 0.1526 - 2568 B
StringArray_FluentAssertions 1,310.5 ns 17.20 ns 16.09 ns 0.2480 - 4152 B
StringArrayInAnyOrder_aweXpect 2,417.1 ns 6.94 ns 5.79 ns 0.1640 - 2760 B
StringArrayInAnyOrder_FluentAssertions 86,942.6 ns 610.17 ns 540.90 ns 3.4180 - 58137 B

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 9, 2025

Test Results

    4 files   -     37      4 suites   - 37   24s ⏱️ - 3m 20s
1 198 tests  - 16 787  1 197 ✅  - 16 786  1 💤  - 1  0 ❌ ±0 
3 486 runs   - 47 106  3 485 ✅  - 47 105  1 💤  - 1  0 ❌ ±0 

Results for commit 1c8d7ff. ± Comparison against base commit 52008dd.

This pull request removes 16839 and adds 52 tests. Note that renamed tests count towards both.
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenAwaited_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenAwaited_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_ShouldBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_WithoutReturnValue_ShouldBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenNotAwaited_WithoutReturnValue_WithVerifyInMethod_ShouldStillBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedStatically_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedStatically_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedWithStaticUsing_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerifiedWithStaticUsing_WithoutReturnValue_ShouldNotBeFlagged
aweXpect.Analyzers.Tests.AwaitExpectationAnalyzerTests ‑ WhenVerified_ShouldNotBeFlagged
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message34b6c27f-ec94-4650-b743-5f99c62dfb09")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message5a016587-0afd-4cf3-b026-3d8d04d80a49")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message9d630b4f-927e-4b59-aff4-4f0b04e05365")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messaged69d6247-c570-4978-bb1f-27d074e4e4f3")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagee341b402-9759-4cac-b3ee-ec3cea489d7d")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messageec171fe2-68e8-43ac-b764-13cf802d14f4")
aweXpect.Core.Tests.Core.ResultContextsTests ‑ AddSameContextMultipleTimes_ShouldStillWork
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason4c6473c9-a461-477f-922e-778e2c851c11")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason5e86b71d-2505-4150-b00f-70070ff88a23")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasonec608470-be67-4ff9-9b79-074132260f8e")
…

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 9, 2025

👽 Mutation Results

Mutation testing badge

aweXpect

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

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Core/ResultContext.cs 75.00% 3 0 0 1 0 0 3 1 4
Core/ResultContexts.cs 100.00% 9 0 0 0 8 0 9 0 17

The final mutation score is 92.31%

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

@vbreuss vbreuss merged commit 6c57313 into main Nov 9, 2025
14 checks passed
@vbreuss vbreuss deleted the topic/use-list-in-resultcontexts branch November 9, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants