Add explicit type tests for AvoidOutParameterOnAssertIsInstanceOfTypeFixer - #9885
Merged
Evangelink merged 1 commit intoJul 13, 2026
Merged
Conversation
…OfTypeFixer Add two tests covering the untested code path where an explicit type is used in the out parameter declaration (e.g., 'out string result' vs 'out var result'), producing a typed VariableDeclarationSyntax. Fixes #9874 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 933245eb-b33b-4685-9afb-d50b0e1a82f3
Contributor
There was a problem hiding this comment.
Pull request overview
Adds explicit-type coverage for the analyzer code fix that converts invalid out string result assertions into typed variable declarations.
Changes:
- Tests conversion with and without message arguments.
- Verifies trivia preservation and multiple occurrences.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/MSTest.Analyzers.UnitTests/AvoidOutParameterOnAssertIsInstanceOfTypeFixerTests.cs |
Adds explicit-type code-fix tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Medium
Contributor
🧪 Test quality grade — PR #9885
This advisory comment was generated automatically. Grades are heuristic
|
0101
approved these changes
Jul 13, 2026
Evangelink
deleted the
dev/amauryleve/test-avoid-out-param-assert-isinstanceof
branch
July 13, 2026 09:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9874
Summary
AvoidOutParameterOnAssertIsInstanceOfTypeFixer.FixIsInstanceOfTypeCallAsynchas two distinct code paths:out string result) → creates aVariableDeclarationSyntax.out result) → creates anAssignmentExpression.The
out var resultcase was covered, but the explicit type case (e.g.,out string result→string result = ...) was not tested.Changes
Added two tests to
AvoidOutParameterOnAssertIsInstanceOfTypeFixerTests.cs:FixIsInstanceOfTypeWithExplicitType_ShouldProduceTypedVariableDeclaration—out string result→string result = Assert.IsInstanceOfType<string>(value)(with/without trivia, single and multi-instance).FixIsInstanceOfTypeWithExplicitTypeAndMessage_ShouldProduceTypedVariableDeclaration— same with a message argument.Verification