Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
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.ThrowsExactly or Assert.ThrowsExactlyAsync 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 |
| MSTEST0025 | PreferAssertFailOverAlwaysFalseConditionsAnalyzer | Use 'Assert.Fail' instead of an always-failing assert |
| MSTEST0029 | PublicMethodShouldBeTestMethod | A public method of a class marked with [TestClass] should be a test method (marked with [TestMethod]). The rule ignores methods that are marked with [TestInitialize], or [TestCleanup] attributes. |
| MSTEST0036 | DoNotUseShadowingAnalyzer | Shadowing test members could cause testing issues (such as NRE). |
| MSTEST0044 | PreferTestMethodOverDataTestMethodAnalyzer | A method or type uses DataTestMethodAttribute or inherits from it. |
| MSTEST0045 | UseCooperativeCancellationForTimeoutAnalyzer | A test method uses TimeoutAttribute without setting the CooperativeCancellation property to true. |
Samarbejd med os på GitHub
Kilden til dette indhold kan findes på GitHub, hvor du også kan oprette og gennemse problemer og pullanmodninger. Du kan få flere oplysninger i vores vejledning til bidragydere.