Skip to content

fix: update parameters to use IThatSubject in callbacks#946

Merged
vbreuss merged 4 commits into
mainfrom
topic/fix-ithatsubject-in-callbacks
May 11, 2026
Merged

fix: update parameters to use IThatSubject in callbacks#946
vbreuss merged 4 commits into
mainfrom
topic/fix-ithatsubject-in-callbacks

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented May 11, 2026

This pull request primarily refactors the codebase to consistently use the IThatSubject<T> interface instead of IThat<T> for expectation actions across collection and exception assertion APIs. This change improves type safety and standardizes the way expectations are expressed throughout the library. Additionally, a build configuration change restricts the build scope to core components only.

API Refactoring: Expectation Actions

  • Updated all collection assertion methods (e.g., ComplyWith, HasItemThat, Contains, IsEqualTo, etc.) to accept Action<IThatSubject<T>> or Action<IThatSubject<T?>> instead of Action<IThat<T>> or Action<IThat<T?>>. This affects both synchronous (IEnumerable<T>) and asynchronous (IAsyncEnumerable<T>) collection APIs.

  • Changed exception assertion methods (e.g., WithInner, WithInnerException, Whose, Which, etc.) to require expectation actions using IThatSubject<T> instead of IThat<T>.

  • Updated internal classes and constructors to use IThatSubject<T> for expectation actions, ensuring consistency throughout the implementation.

Build Configuration

  • Changed the build scope in Build.cs from BuildScope.Default to BuildScope.CoreOnly, limiting the build process to core components.

@vbreuss vbreuss self-assigned this May 11, 2026
Copilot AI review requested due to automatic review settings May 11, 2026 09:06
@vbreuss vbreuss added the bug Something isn't working label May 11, 2026
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

Updates aweXpect’s “drill-in” callback signatures to accept IThatSubject<T> (instead of IThat<T>) so callbacks can perform nested .Is<TType>() type assertions, and locks the behavior in with regression tests and updated public API baselines.

Changes:

  • Switched multiple callback parameters (e.g., Whose/Which/For/CompliesWith, exception inner-exception callbacks, and per-item collection match callbacks) from Action<IThat<...>> to Action<IThatSubject<...>>.
  • Updated internal plumbing (e.g., expectation item wrappers) to invoke callbacks with ThatSubject<T> to enable nested type checks.
  • Added a dedicated regression test suite and updated PublicApiGenerator “Expected” baseline files.

Reviewed changes

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

Show a summary per file
File Description
Tests/aweXpect.Tests/IThatSubjectCallbacks.Tests.cs Adds regression tests ensuring callbacks allow nested .Is<TType>() usage.
Tests/aweXpect.Core.Api.Tests/Expected/aweXpect.Core_netstandard2.0.txt Updates core public API baseline for callback signature changes.
Tests/aweXpect.Core.Api.Tests/Expected/aweXpect.Core_net8.0.txt Updates core public API baseline for callback signature changes.
Tests/aweXpect.Core.Api.Tests/Expected/aweXpect.Core_net10.0.txt Updates core public API baseline for callback signature changes.
Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt Updates public API baseline for callback signature changes in aweXpect.
Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt Updates public API baseline for callback signature changes in aweXpect.
Tests/aweXpect.Api.Tests/Expected/aweXpect_net10.0.txt Updates public API baseline for callback signature changes in aweXpect.
Source/aweXpect/That/ThatGeneric.For.cs Changes For(...) callback to Action<IThatSubject<TMember?>>.
Source/aweXpect/That/ThatGeneric.CompliesWith.cs Changes CompliesWith/DoesNotComplyWith callbacks to IThatSubject<T>.
Source/aweXpect/That/Exceptions/ThatException.HasRecursiveInnerExceptions.cs Changes recursive-inner-exception callback to IThatSubject<IEnumerable<Exception>>.
Source/aweXpect/That/Exceptions/ThatException.HasInnerException.cs Changes inner-exception callback to IThatSubject<Exception?>.
Source/aweXpect/That/Exceptions/ThatException.HasInner.cs Changes HasInner(...) callbacks to IThatSubject<...>.
Source/aweXpect/That/Delegates/ThatDelegateThrows.WithRecursiveInnerExceptions.cs Changes delegate recursive-inner-exception callback to IThatSubject<IEnumerable<Exception>>.
Source/aweXpect/That/Collections/ThatEnumerable.IsEqualTo.cs Changes per-item expected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect/That/Collections/ThatEnumerable.IsContainedIn.cs Changes per-item expected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs Changes HasItemThat callback to Action<IThatSubject<TItem>>.
Source/aweXpect/That/Collections/ThatEnumerable.Elements.ComplyWith.cs Changes Elements.*.ComplyWith callbacks to IThatSubject<...>.
Source/aweXpect/That/Collections/ThatEnumerable.cs Updates internal constraint types for per-item expectation callbacks.
Source/aweXpect/That/Collections/ThatEnumerable.Contains.cs Changes per-item expected/unexpected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.IsEqualTo.cs Changes per-item expected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.IsContainedIn.cs Changes per-item expected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs Changes HasItemThat callback to Action<IThatSubject<TItem>>.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.Elements.ComplyWith.cs Changes Elements.*.ComplyWith callbacks to IThatSubject<...>.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.cs Updates internal constraint types for per-item expectation callbacks.
Source/aweXpect/That/Collections/ThatAsyncEnumerable.Contains.cs Changes per-item expected/unexpected callbacks to Action<IThatSubject<TItem?>>.
Source/aweXpect.Core/Results/AndOrWhoseResult.cs Changes Whose/AndWhose callback types to Action<IThatSubject<TMember?>>.
Source/aweXpect.Core/Results/AndOrWhichResult.cs Changes Which/AndWhich callback types to Action<IThatSubject<TMember?>>.
Source/aweXpect.Core/Options/CollectionMatchOptions.cs Updates ExpectationItem to accept/invoke Action<IThatSubject<TItem?>>.
Source/aweXpect.Core/Delegates/ThatDelegateThrows.WithInnerException.cs Changes inner-exception callback type to Action<IThatSubject<Exception?>>.
Source/aweXpect.Core/Delegates/ThatDelegateThrows.WithInner.cs Changes WithInner(...) callback types to Action<IThatSubject<...>>.
Source/aweXpect.Core/Delegates/ThatDelegateThrows.Whose.cs Changes Whose(...) callback type to Action<IThatSubject<TMember?>>.

Comment thread Tests/aweXpect.Tests/IThatSubjectCallbacks.Tests.cs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

Test Results

    7 files   -     43      7 suites   - 43   45s ⏱️ - 7m 58s
1 253 tests  - 18 538  1 253 ✅  - 18 537  0 💤  - 1  0 ❌ ±0 
6 994 runs   - 95 209  6 994 ✅  - 95 208  0 💤  - 1  0 ❌ ±0 

Results for commit 3104d2f. ± Comparison against base commit 3f417e7.

This pull request removes 18639 and adds 101 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: "message037b1aaa-e2d3-4454-9acf-e1111793b3cb")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message1de29fa5-5e11-41a5-ab99-d12dd5fc1765")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message20fa0453-0437-4fe1-bbc6-7216b5b2ddf1")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message3cfd3fb4-03a6-4f7b-9cdd-e66df564db8d")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message7debb8a3-fa11-49fa-8ef2-13d36b998594")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message9a42fa1b-05f3-4277-befa-19348e471705")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message3783a5f6-f824-476a-a023-b8722c999540")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message8b60663a-8b1a-4f0d-a3a9-fe4e59f2b7f2")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message9d5d7343-4cc5-4c69-8143-fc1668560b9b")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messageab21eec4-12d9-4f9c-9f1f-241284e834ef")
…

♻️ This comment has been updated with latest results.

Copilot AI review requested due to automatic review settings May 11, 2026 09:48
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

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 43 out of 43 changed files in this pull request and generated 3 comments.

Comment thread Pipeline/Build.cs
Comment thread Source/aweXpect/That/ThatGeneric.For.cs
Comment thread Source/aweXpect.Core/Options/CollectionMatchOptions.cs
@vbreuss vbreuss merged commit 084e586 into main May 11, 2026
12 of 13 checks passed
@vbreuss vbreuss deleted the topic/fix-ithatsubject-in-callbacks branch May 11, 2026 10:09
@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.33.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