Skip to content

test: Enable MSTest Analyzers - #858

Merged
Brian Collamore (bcollamore) merged 1 commit into
mainfrom
bcoll/mstest-analyzers
Aug 4, 2025
Merged

test: Enable MSTest Analyzers#858
Brian Collamore (bcollamore) merged 1 commit into
mainfrom
bcoll/mstest-analyzers

Conversation

@bcollamore

Copy link
Copy Markdown
Member

No description provided.

@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2025

Copy link
Copy Markdown

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

This PR enables MSTest Analyzers to improve test code quality and consistency. The changes make helper classes internal/sealed to reduce their public API surface and replace a generic exception assertion with a more specific one.

  • Updated class visibility modifiers from public to internal sealed for test helper classes
  • Replaced Assert.ThrowsExceptionAsync with Assert.ThrowsExactlyAsync for more precise exception testing
  • Enabled MSTest analyzer rules in .editorconfig with error severity (except MSTEST0019 which is disabled)

Reviewed Changes

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

Show a summary per file
File Description
Philips.CodeAnalysis.Test/Helpers/TestTextLoader.cs Changed class visibility from public to internal sealed
Philips.CodeAnalysis.Test/Helpers/TestDiagnosticProvider.cs Changed class visibility from public to internal sealed
Philips.CodeAnalysis.Test/Helpers/TestDefinitions.cs Changed class visibility from public to internal sealed
Philips.CodeAnalysis.Test/Helpers/TestAdditionalFile.cs Changed class visibility from public to internal sealed
Philips.CodeAnalysis.Test/Helpers/AssertCodeHelper.cs Changed class visibility from public to internal sealed
Philips.CodeAnalysis.Test/DuplicateCode/AvoidDuplicateCodeAnalyzerTest.cs Changed nested class visibility from public to internal sealed
Philips.CodeAnalysis.Test/Common/SingleDiagnosticAnalyzerSyntaxKindTest.cs Replaced Assert.ThrowsExceptionAsync with Assert.ThrowsExactlyAsync
Philips.CodeAnalysis.Test/Common/AllowedSymbolsTestAnalyzer.cs Changed class visibility from public to internal sealed
.editorconfig Added MSTest analyzer rules configuration

Comment thread .editorconfig
@bcollamore
Brian Collamore (bcollamore) added this pull request to the merge queue Aug 4, 2025
Merged via the queue into main with commit 86a0631 Aug 4, 2025
11 checks passed
@bcollamore
Brian Collamore (bcollamore) deleted the bcoll/mstest-analyzers branch August 4, 2025 14:36
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.

Enable MS Test Analyzers

3 participants