Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for asynchronous Because reasons in the aweXpect assertion library, allowing users to provide a Task<string> as the reason for an expectation.
Changes:
- Introduces
IBecauseReasoninterface to support both synchronous and asynchronous reason handling - Adds
AsyncBecauseReasonstruct to handleTask<string>reasons - Updates
ExpectationResultto acceptTask<string>inBecause()method
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Source/aweXpect.Core/Core/Helpers/IBecauseReason.cs | New interface defining async contract for applying reasons to constraint results |
| Source/aweXpect.Core/Core/Helpers/BecauseReason.cs | Updated to implement IBecauseReason interface with async return type |
| Source/aweXpect.Core/Core/Helpers/AsyncBecauseReason.cs | New struct implementing async reason handling for Task<string> |
| Source/aweXpect.Core/Core/ExpectationBuilder.cs | Adds overload to support Task<string> reasons |
| Source/aweXpect.Core/Results/ExpectationResult.cs | Adds Because(Task<string>) overloads for async reason support |
| Source/aweXpect.Core/Core/Nodes/Node.cs | Updates abstract method signature to use IBecauseReason |
| Source/aweXpect.Core/Core/Nodes/ExpectationNode.cs | Refactors to apply reason asynchronously after constraint evaluation |
| Source/aweXpect.Core/Core/Nodes/AndNode.cs | Updates to use IBecauseReason interface |
| Source/aweXpect.Core/Core/Nodes/OrNode.cs | Updates to use IBecauseReason interface |
| Source/aweXpect.Core/Core/Nodes/WhichNode.cs | Updates to use IBecauseReason interface |
| Tests/aweXpect.Core.Tests/Core/BecauseTests.cs | Adds test coverage for async Because functionality with Action and Func delegates |
| Tests/aweXpect.Core.Tests/TestHelpers/DummyNode.cs | Updates test helper to use IBecauseReason interface |
| Tests/aweXpect.Core.Api.Tests/ApiAcceptance.cs | Removes [Explicit] attribute to enable API acceptance test |
|
|
||
| internal interface IBecauseReason | ||
| { | ||
|
|
There was a problem hiding this comment.
Remove unnecessary blank line inside the interface definition.
| /// </summary> | ||
| [TestCase] | ||
| [Explicit] | ||
| public async Task AcceptApiChanges() |
There was a problem hiding this comment.
The removal of the [Explicit] attribute enables this test to run automatically. This test updates the expected public API to match the current API surface, which should typically require manual intervention. Ensure this change is intentional and that the API changes in this PR have been reviewed and approved before allowing automatic execution of this test.
|
Test Results 23 files - 27 23 suites - 27 7m 8s ⏱️ - 1m 37s Results for commit f3f91af. ± Comparison against base commit 9f92c67. This pull request removes 3108 and adds 3081 tests. Note that renamed tests count towards both. |
🚀 Benchmark ResultsDetails
|
|
This is addressed in release v2.30.0. |



This PR adds support for asynchronous
Becausereasons in the aweXpect assertion library, allowing users to provide aTask<string>as the reason for an expectation.Key Changes:
IBecauseReasoninterface to support both synchronous and asynchronous reason handlingAsyncBecauseReasonstruct to handleTask<string>reasonsExpectationResultto acceptTask<string>inBecause()method