Skip to content

Add file-resolution and caret-based lookup tests verifying which handler file Go to Handler resolves for a MediatR request - #123

Merged
kzryzstof merged 12 commits into
mainfrom
features/caret-based-handler-lookup-test
Sep 19, 2026
Merged

kzryzstof merged 12 commits into
mainfrom
features/caret-based-handler-lookup-test

Conversation

@kzryzstof

@kzryzstof kzryzstof commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds coverage for the plugin's "Go to Handler" navigation: tests that verify which handler file gets resolved for a given MediatR request, not just which handler type. One variant checks this by request name across the shared MediatR v12/v13/v14 fixtures; the other places a real caret on the request and resolves the underlying PSI node through the SDK's own caret-to-element utility, closer to how the plugin's action itself locates the selected request in the editor.

Changes

  • LookupTestBase.AssertHandlerFilesFor(...): resolves a request's handler(s) and asserts the relative file path(s) they're declared in, reusing the existing TestSolutionFiles.MediatR fixture set.
  • MediatR.Requests.Tests.cs: new FindHandlers_CaretOnRequest_HandlerFileReturned test using the above.
  • GoToHandlerCaretTests (+ V12/V13/V14 variants): places a {caret} marker on a request type in a dedicated fixture, resolves the PSI identifier under it via TextControlToPsi.GetElement<IIdentifier>, and asserts the resolved handler's file.
  • New fixture: test/data/GoToHandlerCaretTests/Request.cs (with {caret} marker) and Handler.cs.

Related

  • No Jira ticket for this work.

Generated by describe-pr skill v1.1.0

@kzryzstof
kzryzstof marked this pull request as draft September 7, 2026 23:34
@kzryzstof kzryzstof changed the title test: add file-resolution and caret-based lookup tests for Go to Handler Add file-resolution and caret-based lookup tests verifying which handler file Go to Handler resolves for a MediatR request Sep 7, 2026
dependabot Bot and others added 2 commits September 19, 2026 09:00
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@kzryzstof
kzryzstof marked this pull request as ready for review September 19, 2026 13:38
kzryzstof and others added 9 commits September 19, 2026 09:39
… to Handler

Adds a way to verify which handler file the plugin resolves for a given
request, both by name lookup (AssertHandlerFilesFor, run across the shared
MediatR v12/v13/v14 fixture) and by placing a real caret via SDK text-control
support and resolving the PSI node under it, mirroring how GoToHandlerAction
gets its selected identifier in production.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0184Nxbg3pykkbbRL1E1o15M
The JetBrains test framework reuses one LookupTestBase instance across
every [Test] method in a fixture (solution loading is too expensive to
redo per test), so _expectedHandlerNames and _expectedHandlerFilePaths
survived from whichever assertion ran last. Once a caret-file-lookup
test set _expectedHandlerFilePaths, every later name-based test in the
same fixture instance silently ran the file-path branch of DoTest
against its stale expectation instead of its own assertion, failing
CI with mismatched expected/actual handler paths.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0184Nxbg3pykkbbRL1E1o15M
…tion scenarios

Adds tests for caret placement scenarios on identifiers not resolving to handlers, including namespace identifiers and MediatR `Send` calls. Refactors test logic to handle cases with no expected handler matches.
Renames `TestName` to `TestMethodName` for better alignment with its purpose and to prevent ambiguity in test logic.
Introduces `MediatRCallsite` and `MediatorCallsite` classes to handle MediatR request sending with `CustomClassRequest` and `NewMediatorRequest`.
…ediatR naming conventions

Renames classes and file references in GoToHandlerCaretTests to align with the MediatR naming standard, ensuring uniformity across test files.
@kzryzstof
kzryzstof force-pushed the features/caret-based-handler-lookup-test branch from ea17d39 to cc2456f Compare September 19, 2026 13:54
@kzryzstof
kzryzstof merged commit 3add734 into main Sep 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants