Skip to content

Comments

[MSTest] Do not use var when type is not explicit#51752

Merged
Evangelink merged 1 commit intomainfrom
dev/amauryleve/no-var
Feb 17, 2026
Merged

[MSTest] Do not use var when type is not explicit#51752
Evangelink merged 1 commit intomainfrom
dev/amauryleve/no-var

Conversation

@Evangelink
Copy link
Member

@Evangelink Evangelink commented Feb 16, 2026

Summary

Apply feedback about usage of var in MSTest docs.


Internal previews

📄 File 🔗 Preview link
docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md MSTest lifecycle
docs/core/testing/unit-testing-mstest-writing-tests.md Write tests with MSTest

Copilot AI review requested due to automatic review settings February 16, 2026 15:15
@dotnetrepoman dotnetrepoman bot added this to the February 2026 milestone Feb 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates MSTest documentation and snippets to avoid var when the assigned type isn’t explicit from the right-hand side, improving clarity and aligning the examples with the intended guidance.

Changes:

  • Replaced var with int for Calculator.Add(...) results in MSTest docs.
  • Replaced var with HttpResponseMessage for HttpClient.GetAsync(...) results in lifecycle examples.
  • Replaced var with bool for IsPrime(...) results in the MSTest sample test snippet.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/core/testing/unit-testing-mstest-writing-tests.md Makes result types explicit in introductory MSTest examples where the RHS doesn’t show the type.
docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md Makes HTTP response and calculator result types explicit in lifecycle examples.
docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService_IsPrimeShould.cs Makes IsPrime result type explicit in the MSTest sample snippet.

@Evangelink Evangelink enabled auto-merge (squash) February 16, 2026 20:35
@Evangelink Evangelink merged commit b85621f into main Feb 17, 2026
19 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/no-var branch February 17, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants