fix: Allow Item.Member after HasSingleItem - #6583
Conversation
📝 WalkthroughWalkthrough
ChangesMember assertion fix
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR routes type-erased member assertions through the standard assertion pipeline so deferred pre-work is preserved for
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness or security issues identified. The changed wrapper preserves deferred pre-work through mapped assertion contexts, executes it once, and continues to propagate inner assertion failures through the existing exception and assertion-scope mechanisms.
|
| Filename | Overview |
|---|---|
| src/TUnit.Assertions/Conditions/MemberAssertion.cs | Moves type-erased member assertion execution into the base assertion pipeline, preserving mapped pending pre-work without introducing duplicate execution or failure masking. |
| tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs | Adds focused regression coverage for member assertions following both forms of HasSingleItem().Item. |
Reviews (1): Last reviewed commit: "fix: Allow Item.Member after HasSingleIt..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs (1)
13-15: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd failing member-assertion cases.
These tests prove that the chain does not throw for matching values. They do not prove that
Member(...).IsEqualTo(...)executes. If the inner assertion were skipped, both tests would still pass. Add negative-path cases with a mismatched member value and the existing assertion-failure helper.Also applies to: 27-29
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs` around lines 13 - 15, Add negative-path tests in the affected member-assertion test cases, using a mismatched member value and the existing assertion-failure helper. Ensure each case verifies that Member(...).IsEqualTo(...) executes and reports failure, while preserving the current matching-value coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs`:
- Around line 13-15: Add negative-path tests in the affected member-assertion
test cases, using a mismatched member value and the existing assertion-failure
helper. Ensure each case verifies that Member(...).IsEqualTo(...) executes and
reports failure, while preserving the current matching-value coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6e93d3a9-f5da-404c-8f8e-52710a8c4987
📒 Files selected for processing (2)
src/TUnit.Assertions/Conditions/MemberAssertion.cstests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs
|
Thanks @SnakyBeaky ! |
Description
Ensure TypeErasedAssertion uses the standard assertion execution pipeline, preserving deferred pre-work from
HasSingleItem().Item.Added a regression coverage test for the issue.
Related Issue
Fixes #6581
Type of Change
Checklist
Required
Testing
dotnet test)Summary by CodeRabbit
Bug Fixes
Tests