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 ! |
Updated [TUnit.Core](https://github.com/thomhurst/TUnit) from 1.64.6 to 1.65.0. <details> <summary>Release notes</summary> _Sourced from [TUnit.Core's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.65.0 <!-- Release notes generated using configuration in .github/release.yml at v1.65.0 --> ## What's Changed ### Other Changes * Report unexpected mock generation failures by @thomhurst in thomhurst/TUnit#6605 * Process every GenerateMock attribute by @thomhurst in thomhurst/TUnit#6606 * Support T.Mock() for static abstract interfaces by @thomhurst in thomhurst/TUnit#6607 ### Dependencies * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.303 by @thomhurst in thomhurst/TUnit#6586 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.303 by @thomhurst in thomhurst/TUnit#6587 * chore(deps): update microsoft.build to 18.9.6 by @thomhurst in thomhurst/TUnit#6585 * chore(deps): update dependency fsharp.core to 10.1.400 by @thomhurst in thomhurst/TUnit#6588 * chore(deps): update dependency microsoft.entityframeworkcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6589 * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.400 by @thomhurst in thomhurst/TUnit#6591 * chore(deps): update dependency dotnet-sdk to v10.0.400 by @thomhurst in thomhurst/TUnit#6590 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.400 by @thomhurst in thomhurst/TUnit#6592 * chore(deps): update dependency system.commandline to 2.0.11 by @thomhurst in thomhurst/TUnit#6593 * chore(deps): update microsoft.extensions to 10.0.11 by @thomhurst in thomhurst/TUnit#6595 * chore(deps): update microsoft.aspnetcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6594 * chore(deps): update tunit to 1.64.13 by @thomhurst in thomhurst/TUnit#6596 * chore(deps): update dependency nuget.protocol to 7.9.0 by @thomhurst in thomhurst/TUnit#6597 * chore(deps): update microsoft.extensions to 10.9.0 by @thomhurst in thomhurst/TUnit#6598 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6601 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6600 * chore(deps): update dependency microsoft.testing.extensions.codecoverage to 18.10.0 by @thomhurst in thomhurst/TUnit#6602 **Full Changelog**: thomhurst/TUnit@v1.64.13...v1.65.0 ## 1.64.13 <!-- Release notes generated using configuration in .github/release.yml at v1.64.13 --> ## What's Changed ### Other Changes * Stabilize immediate WaitsFor assertion test by @thomhurst in thomhurst/TUnit#6576 * fix: Allow Item.Member after HasSingleItem by @SnakyBeaky in thomhurst/TUnit#6583 ### Dependencies * chore(deps): update tunit to 1.64.6 by @thomhurst in thomhurst/TUnit#6577 * chore(deps): update dependency nsubstitute to 6.2.0 by @thomhurst in thomhurst/TUnit#6580 * chore(deps): update dependency microsoft.playwright to 1.62.0 by @thomhurst in thomhurst/TUnit#6582 * chore(deps): update dependency microsoft.net.stringtools to 18.9.6 by @thomhurst in thomhurst/TUnit#6584 ## New Contributors * @SnakyBeaky made their first contribution in thomhurst/TUnit#6583 **Full Changelog**: thomhurst/TUnit@v1.64.6...v1.64.13 Commits viewable in [compare view](thomhurst/TUnit@v1.64.6...v1.65.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updated [Microsoft.SourceLink.GitHub](https://github.com/dotnet/dotnet) from 10.0.301 to 10.0.400. <details> <summary>Release notes</summary> _Sourced from [Microsoft.SourceLink.GitHub's releases](https://github.com/dotnet/dotnet/releases)._ ## 10.0.400 You can build .NET 10.0 from the repository by cloning the release tag `v10.0.400` and following the build instructions in the [main README.md](https://github.com/dotnet/dotnet/blob/v10.0.400/README.md#building). Alternatively, you can build from the sources attached to this release directly. More information on this process can be found in the [dotnet/dotnet repository](https://github.com/dotnet/dotnet/blob/v10.0.400/README.md#building-from-released-sources). Attached are PGP signatures for the GitHub generated tarball and zipball. You can find the public key at https://dot.net/release-key-2023 ## 10.0.303 You can build .NET 10.0 from the repository by cloning the release tag `v10.0.303` and following the build instructions in the [main README.md](https://github.com/dotnet/dotnet/blob/v10.0.303/README.md#building). Alternatively, you can build from the sources attached to this release directly. More information on this process can be found in the [dotnet/dotnet repository](https://github.com/dotnet/dotnet/blob/v10.0.303/README.md#building-from-released-sources). Attached are PGP signatures for the GitHub generated tarball and zipball. You can find the public key at https://dot.net/release-key-2023 ## 10.0.302 You can build .NET 10.0 from the repository by cloning the release tag `v10.0.302` and following the build instructions in the [main README.md](https://github.com/dotnet/dotnet/blob/v10.0.302/README.md#building). Alternatively, you can build from the sources attached to this release directly. More information on this process can be found in the [dotnet/dotnet repository](https://github.com/dotnet/dotnet/blob/v10.0.302/README.md#building-from-released-sources). Attached are PGP signatures for the GitHub generated tarball and zipball. You can find the public key at https://dot.net/release-key-2023 Commits viewable in [compare view](dotnet/dotnet@v10.0.301...v10.0.400). </details> Updated [Roslynator.Analyzers](https://github.com/dotnet/roslynator) from 4.15.0 to 4.16.0. <details> <summary>Release notes</summary> _Sourced from [Roslynator.Analyzers's releases](https://github.com/dotnet/roslynator/releases)._ ## 4.16.0 ### Added - [CLI] Suppress error code from Roslynator when it detects issues in code but runs successfully ([PR](dotnet/roslynator#1756) by @mdrybak) ### Fixed - Fix analyzer [RCS1118](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1118) to not report local variable passed as 'in' argument ([PR](dotnet/roslynator#1782) by @NoahStolk) - Fix analyzer [RCS1074](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1074) ([PR](dotnet/roslynator#1768) by @cbersch) - Fix enum contained flags check for partial matches in [RCS1258](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1258) ([PR](dotnet/roslynator#1740) by @ovska) - Fix analyzer [RCS1146](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146) ([PR](dotnet/roslynator#1747)) - Fix analyzer [RCS1194](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1194) ([PR](dotnet/roslynator#1733)) - Fix analyzer [RCS1060](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1060) to ignore classes marked with `file` modifier ([PR](dotnet/roslynator#1777) by @cbersch) - Fix analyzer [RCS1231](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1231) ([PR](dotnet/roslynator#1774) by @cbersch) - Fix analyzer [RCS1246](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1246) for conditional access expressions ([PR](dotnet/roslynator#1772 by @krajek)) - [CLI] Fix `fix` command ignoring `--include` / `--exclude` file filter ([PR](dotnet/roslynator#1758) by @hashiiiii) - [CLI] Fix loading of projects and solutions on .NET 10 SDK ([PR](dotnet/roslynator#1783)) Commits viewable in [compare view](dotnet/roslynator@v4.15.0...v4.16.0). </details> Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.63.0 to 1.65.0. <details> <summary>Release notes</summary> _Sourced from [TUnit's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.65.0 <!-- Release notes generated using configuration in .github/release.yml at v1.65.0 --> ## What's Changed ### Other Changes * Report unexpected mock generation failures by @thomhurst in thomhurst/TUnit#6605 * Process every GenerateMock attribute by @thomhurst in thomhurst/TUnit#6606 * Support T.Mock() for static abstract interfaces by @thomhurst in thomhurst/TUnit#6607 ### Dependencies * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.303 by @thomhurst in thomhurst/TUnit#6586 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.303 by @thomhurst in thomhurst/TUnit#6587 * chore(deps): update microsoft.build to 18.9.6 by @thomhurst in thomhurst/TUnit#6585 * chore(deps): update dependency fsharp.core to 10.1.400 by @thomhurst in thomhurst/TUnit#6588 * chore(deps): update dependency microsoft.entityframeworkcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6589 * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.400 by @thomhurst in thomhurst/TUnit#6591 * chore(deps): update dependency dotnet-sdk to v10.0.400 by @thomhurst in thomhurst/TUnit#6590 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.400 by @thomhurst in thomhurst/TUnit#6592 * chore(deps): update dependency system.commandline to 2.0.11 by @thomhurst in thomhurst/TUnit#6593 * chore(deps): update microsoft.extensions to 10.0.11 by @thomhurst in thomhurst/TUnit#6595 * chore(deps): update microsoft.aspnetcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6594 * chore(deps): update tunit to 1.64.13 by @thomhurst in thomhurst/TUnit#6596 * chore(deps): update dependency nuget.protocol to 7.9.0 by @thomhurst in thomhurst/TUnit#6597 * chore(deps): update microsoft.extensions to 10.9.0 by @thomhurst in thomhurst/TUnit#6598 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6601 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6600 * chore(deps): update dependency microsoft.testing.extensions.codecoverage to 18.10.0 by @thomhurst in thomhurst/TUnit#6602 **Full Changelog**: thomhurst/TUnit@v1.64.13...v1.65.0 ## 1.64.13 <!-- Release notes generated using configuration in .github/release.yml at v1.64.13 --> ## What's Changed ### Other Changes * Stabilize immediate WaitsFor assertion test by @thomhurst in thomhurst/TUnit#6576 * fix: Allow Item.Member after HasSingleItem by @SnakyBeaky in thomhurst/TUnit#6583 ### Dependencies * chore(deps): update tunit to 1.64.6 by @thomhurst in thomhurst/TUnit#6577 * chore(deps): update dependency nsubstitute to 6.2.0 by @thomhurst in thomhurst/TUnit#6580 * chore(deps): update dependency microsoft.playwright to 1.62.0 by @thomhurst in thomhurst/TUnit#6582 * chore(deps): update dependency microsoft.net.stringtools to 18.9.6 by @thomhurst in thomhurst/TUnit#6584 ## New Contributors * @SnakyBeaky made their first contribution in thomhurst/TUnit#6583 **Full Changelog**: thomhurst/TUnit@v1.64.6...v1.64.13 ## 1.64.6 <!-- Release notes generated using configuration in .github/release.yml at v1.64.6 --> ## What's Changed ### Other Changes * Switch NuGet publishing to trusted publishing by @thomhurst in thomhurst/TUnit#6573 * Expose results directory through TestContext by @thomhurst in thomhurst/TUnit#6575 * Fix outcome timeline overflow in HTML reports by @thomhurst in thomhurst/TUnit#6574 ### Dependencies * chore(deps): update tunit to 1.64.0 by @thomhurst in thomhurst/TUnit#6570 **Full Changelog**: thomhurst/TUnit@v1.64.0...v1.64.6 ## 1.64.0 <!-- Release notes generated using configuration in .github/release.yml at v1.64.0 --> ## What's Changed ### Other Changes * Honor cancellation tokens linked by custom test executors by @thomhurst in thomhurst/TUnit#6565 * Fix linked cancellation from before-test hooks by @thomhurst in thomhurst/TUnit#6568 * Add per-test execution cancellation by @thomhurst in thomhurst/TUnit#6569 ### Dependencies * chore(deps): update tunit to 1.63.25 by @thomhurst in thomhurst/TUnit#6559 * chore(deps): update dependency serialize-javascript to v7.1.0 by @thomhurst in thomhurst/TUnit#6561 * chore(deps): update dependency nsubstitute to 6.1.0 by @thomhurst in thomhurst/TUnit#6564 * chore(deps): bump mermaid from 11.15.0 to 11.16.1 in /docs by @dependabot[bot] in thomhurst/TUnit#6563 * chore(deps): bump nanoid from 3.3.16 to 3.3.18 in /docs by @dependabot[bot] in thomhurst/TUnit#6562 **Full Changelog**: thomhurst/TUnit@v1.63.25...v1.64.0 ## 1.63.25 <!-- Release notes generated using configuration in .github/release.yml at v1.63.25 --> ## What's Changed ### Other Changes * Fix Mermaid label contrast in dark mode by @thomhurst in thomhurst/TUnit#6531 * Enhance matrix tests documentation by @koryphaee in thomhurst/TUnit#6537 * fix: support nested Member after IsTypeOf by @mvanhorn in thomhurst/TUnit#6540 * docs: Add documentation for TestContext.Parameters by @thomhurst with @Copilot in thomhurst/TUnit#6558 * fix: run event receivers on injected properties by @thomhurst in thomhurst/TUnit#6556 ### Dependencies * chore(deps): update tunit to 1.63.0 by @thomhurst in thomhurst/TUnit#6526 * chore(deps): update dependency stackexchange.redis to 3.1.0 by @thomhurst in thomhurst/TUnit#6529 * chore(deps): update verify to 31.28.0 by @thomhurst in thomhurst/TUnit#6532 * chore(deps): update dependency stackexchange.redis to 3.1.3 by @thomhurst in thomhurst/TUnit#6541 * chore(deps): update dependency dompurify to v3.4.13 by @thomhurst in thomhurst/TUnit#6542 * chore(deps): update dependency rabbitmq.client to 7.2.2 by @thomhurst in thomhurst/TUnit#6546 * chore(deps): update dependency polyfill to 11.0.2 by @thomhurst in thomhurst/TUnit#6549 * chore(deps): update dependency polyfill to 11.0.2 by @thomhurst in thomhurst/TUnit#6548 * chore(deps): bump fast-uri from 3.1.4 to 3.1.5 in /docs by @dependabot[bot] in thomhurst/TUnit#6545 * chore(deps): bump postcss from 8.5.22 to 8.5.25 in /docs by @dependabot[bot] in thomhurst/TUnit#6547 * chore(deps): update dependency stackexchange.redis to 3.1.11 by @thomhurst in thomhurst/TUnit#6550 * chore(deps): update dependency stackexchange.redis to 3.1.13 by @thomhurst in thomhurst/TUnit#6552 ## New Contributors * @koryphaee made their first contribution in thomhurst/TUnit#6537 **Full Changelog**: thomhurst/TUnit@v1.63.0...v1.63.25 Commits viewable in [compare view](thomhurst/TUnit@v1.63.0...v1.65.0). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nick Cosentino <nbcosentino@gmail.com>
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