Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
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. |
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.