Skip to content

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Sep 4, 2025

This PR fixes nullability annotations in the MemberAccessor class to improve type safety. The changes remove unnecessary nullable annotations from the FromExpression method and update related test infrastructure to support the new nullability semantics.

Key changes:

  • Removed nullable annotations from MemberAccessor.FromExpression method parameters and return types
  • Updated test helper DummyNode to track member accessors for testing purposes
  • Added comprehensive tests for WhichNode functionality with proper member accessor handling

@vbreuss vbreuss self-assigned this Sep 4, 2025
Copilot AI review requested due to automatic review settings September 4, 2025 12:18
@vbreuss vbreuss added the bug Something isn't working label Sep 4, 2025
Copy link

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 nullability annotations in the MemberAccessor class to improve type safety. The changes remove unnecessary nullable annotations from the FromExpression method and update related test infrastructure to support the new nullability semantics.

Key changes:

  • Removed nullable annotations from MemberAccessor.FromExpression method parameters and return types
  • Updated test helper DummyNode to track member accessors for testing purposes
  • Added comprehensive tests for WhichNode functionality with proper member accessor handling

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Source/aweXpect.Core/Core/MemberAccessor.cs Removed nullable annotations from FromExpression method to fix nullability semantics
Tests/aweXpect.Core.Tests/TestHelpers/DummyNode.cs Added MappingMemberAccessor property and implemented AddMapping/AddAsyncMapping methods for testing
Tests/aweXpect.Core.Tests/Core/Nodes/WhichNodeTests.cs Added comprehensive tests for WhichNode functionality and removed unused StringBuilder variable
Source/aweXpect.Core/Core/Nodes/WhichNode.cs Simplified Equals method by removing member accessor comparisons

@vbreuss vbreuss enabled auto-merge (squash) September 4, 2025 12:22
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

Test Results

    14 files   - 24      14 suites   - 24   3m 46s ⏱️ -51s
17 417 tests  -  5  17 415 ✅  -  5  2 💤 ±0  0 ❌ ±0 
48 909 runs   - 12  48 907 ✅  - 12  2 💤 ±0  0 ❌ ±0 

Results for commit 5e4284d. ± Comparison against base commit d9f4c5a.

This pull request removes 1572 and adds 1567 tests. Note that renamed tests count towards both.
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message547eb3f5-957f-4fee-9847-d74078be8a4e")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message9ba43638-4d1c-4d8d-a116-fab013febd39")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messagebfb12897-b549-4996-8622-48dc3605dfd1")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message6759f642-6295-4db4-bb8d-2e50d9b67c24")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messageb3684c9e-f452-46ce-aecf-cb665077d59e")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messageb9dec029-1f38-4366-b4e1-c8a96c1151db")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason84157c5a-53c2-4b84-8666-979b7bb6a75f")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasona20aeec0-26c8-4485-9285-86ef42ede18b")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasonc383d84c-a59d-4cdf-b632-594a95e54af2")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reason4a79713f-c2b2-45d1-a769-1f17a7bbc09e")
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message13d3e4e9-11b2-479c-b6b0-43fe36f87933")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message3b182aa1-cdd0-43dc-b2d5-2d04e0a6b603")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message413c2b3c-ca77-4405-84f9-94f4f7b9b53c")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message1cc49deb-3c4f-445e-8d2a-619dc8953547")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message2114b0f2-6c06-4c87-893d-4ab856540f68")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messaged3323c76-4d41-4611-ba7e-a0eac2f86eb7")
aweXpect.Core.Tests.Core.Nodes.WhichNodeTests ‑ AddAsyncMapping_WithInnerNode_ShouldAddMappingToInnerNode
aweXpect.Core.Tests.Core.Nodes.WhichNodeTests ‑ AddAsyncMapping_WithoutInnerNode_ShouldNotThrow
aweXpect.Core.Tests.Core.Nodes.WhichNodeTests ‑ AddMapping_WithInnerNode_ShouldAddMappingToInnerNode
aweXpect.Core.Tests.Core.Nodes.WhichNodeTests ‑ AppendExpectation_WithInnerNode_ShouldAppendSeparatorAndInnerExpectation
…

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 4, 2025

@vbreuss vbreuss merged commit f000f6a into main Sep 4, 2025
14 checks passed
@vbreuss vbreuss deleted the topic/fix-nullability-of-memberaccessor branch September 4, 2025 12:32
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 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 242.0 ns 3.64 ns 3.40 ns 0.0300 - 504 B
Bool_FluentAssertions 279.5 ns 3.24 ns 3.03 ns 0.0567 - 952 B
Bool_TUnit 966.4 ns 8.87 ns 8.30 ns 0.1431 - 2408 B
Equivalency_aweXpect 342,539.7 ns 733.71 ns 650.42 ns 20.0195 0.9766 335556 B
Equivalency_FluentAssertions 2,419,860.1 ns 5,268.46 ns 4,113.27 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 740,290.2 ns 3,088.64 ns 2,889.12 ns 51.7578 2.9297 880545 B
Int_GreaterThan_aweXpect 277.6 ns 2.13 ns 2.00 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 286.3 ns 4.14 ns 3.87 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 1,294.5 ns 8.15 ns 7.22 ns 0.1774 - 2984 B
ItemsCount_AtLeast_aweXpect 550.2 ns 3.61 ns 3.38 ns 0.0868 - 1464 B
ItemsCount_AtLeast_FluentAssertions 565.0 ns 5.02 ns 4.70 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 16,185.7 ns 69.53 ns 61.64 ns 1.6174 - 27480 B
String_aweXpect 477.0 ns 2.84 ns 2.51 ns 0.0734 - 1232 B
String_FluentAssertions 543.4 ns 2.96 ns 2.77 ns 0.1287 - 2168 B
String_TUnit 1,323.6 ns 6.47 ns 6.05 ns 0.1831 - 3072 B
StringArray_aweXpect 1,833.6 ns 11.45 ns 10.71 ns 0.1717 - 2888 B
StringArray_FluentAssertions 1,475.7 ns 10.73 ns 10.03 ns 0.2480 - 4152 B
StringArray_TUnit 3,462.4 ns 8.62 ns 8.06 ns 0.3128 - 5296 B
StringArrayInAnyOrder_aweXpect 2,309.7 ns 6.13 ns 5.74 ns 0.1831 - 3080 B
StringArrayInAnyOrder_FluentAssertions 154,019.8 ns 309.81 ns 258.70 ns 3.4180 - 63788 B
StringArrayInAnyOrder_TUnit 4,133.1 ns 15.17 ns 12.67 ns 0.3815 - 6488 B

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 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/MemberAccessor.cs 68.18% 15 4 0 3 4 2 15 7 28
Core/Nodes/WhichNode.cs 100.00% 27 0 1 0 11 31 28 0 70

The final mutation score is 86.00%

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

github-actions bot added a commit that referenced this pull request Sep 4, 2025
github-actions bot added a commit that referenced this pull request Sep 4, 2025
@github-actions
Copy link
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