MSTest design rules

Design rules will help you create and maintain test suites that adhere to proper design and good practices.

Identifier Name Description
MSTEST0004 PublicTypeShouldBeTestClassAnalyzer It's considered a good practice to have only test classes marked public in a test project.
MSTEST0006 AvoidExpectedExceptionAttributeAnalyzer Prefer Assert.ThrowsException or Assert.ThrowsExceptionAsync over [ExpectedException] as it ensures that only the expected call throws the expected exception. The assert APIs also provide more flexibility and allow you to assert extra properties of the exception.
MSTEST0015 TestMethodShouldNotBeIgnored Test methods should not be ignored (marked with [Ignore]).
MSTEST0016 TestClassShouldHaveTestMethod Test class should have at least one test method or be 'static' with method(s) marked by '[AssemblyInitialization]' and/or '[AssemblyCleanup]'.
MSTEST0019 PreferTestInitializeOverConstructorAnalyzer Prefer TestInitialize methods over constructors
MSTEST0020 PreferConstructorOverTestInitializeAnalyzer Prefer constructors over TestInitialize methods
MSTEST0021 PreferDisposeOverTestCleanupAnalyzer Prefer Dispose over TestCleanup methods
MSTEST0022 PreferTestCleanupOverDisposeAnalyzer Prefer TestCleanup over Dispose methods