Skip to content

Add test for MSTEST0026 right operand conditional access#10178

Merged
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/test-mstest0026-right-operand
Jul 23, 2026
Merged

Add test for MSTEST0026 right operand conditional access#10178
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/test-mstest0026-right-operand

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • cover conditional access in the right operand of binary expressions for MSTEST0026
  • verify diagnostics for Assert.IsTrue and Assert.IsFalse
  • verify the code fix inserts a null assertion and removes conditional access

Testing

  • targeted MSTest.Analyzers.UnitTests test passed on net8.0

Closes #10153

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cd8b0e4d-9508-4e83-bcc7-3112c78255c4
Copilot AI review requested due to automatic review settings July 23, 2026 14:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted MSTEST0026 coverage for conditional access on a binary expression’s right operand.

Changes:

  • Tests diagnostics for Assert.IsTrue and Assert.IsFalse.
  • Verifies the fix adds one null assertion and removes conditional access.
Show a summary per file
File Description
AssertionArgsShouldAvoidConditionalAccessAnalyzerTests.cs Adds right-operand analyzer and code-fix coverage.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

Review Summary

This PR adds a well-structured test covering the binaryOperation.RightOperand path in HasAnyConditionalAccessOperationChild. Reviewed across all 22 dimensions — no actionable issues found.

Dimension Verdict
Correctness ✅ Clean
Test Quality ✅ Clean
Naming & Readability ✅ Clean
Assertion Quality ✅ Clean
Coverage Completeness ✅ Clean
Threading N/A (test-only)
Security N/A
Public API N/A
Performance N/A
Backward Compat N/A
Error Handling N/A
Localization N/A
Documentation ✅ Clean (comment explains intent)
Code Style ✅ Clean
Duplication ✅ Clean
Dependencies N/A
Disposal N/A
Nullability ✅ Clean
Platform Compat N/A
Diagnostics/Logging N/A
Serialization N/A
Extensibility N/A

Overall: Ship it. The test is correct, well-named, exercises two distinct binary patterns (< and ==), validates both the diagnostic and the code fix, and uses appropriate iteration counts.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #10178

GradeTestNotes
B (80–89) new AssertionArgsShouldAvoidConditionalAccessAnalyzerTests.
WhenConditionalAccessIsRightOperandOfBinaryExpression_
Diagnostic
Solid diagnostic + fix verification via [|...|] markers and FixedCode; body is ~46 lines (inherent to Roslyn string-embedded tests) — consider extracting shared code strings into helpers if this pattern recurs.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Re-run with
/grade-tests.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · sonnet46 29.8 AIC · ⌖ 5.68 AIC · ⊞ 9K · [◷]( · )

@Evangelink Evangelink added the state/needs-review Awaiting review from the team. label Jul 23, 2026
@Evangelink
Evangelink enabled auto-merge (squash) July 23, 2026 14:36
@Evangelink
Evangelink merged commit 0d27a1e into main Jul 23, 2026
34 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/test-mstest0026-right-operand branch July 23, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-improver] Add test for RightOperand conditional access path in MSTEST0026 analyzer

3 participants