title | description | ms.date | f1_keywords | helpviewer_keywords | author | ms.author | ||||
---|---|---|---|---|---|---|---|---|---|---|
MSTEST0008: TestInitialize method should have valid layout |
Learn about code analysis rule MSTEST0008: TestInitialize method should have valid layout |
02/19/2024 |
|
|
engyebrahim |
enjieid |
Property | Value |
---|---|
Rule ID | MSTEST0008 |
Title | TestInitialize method should have valid layout |
Category | Usage |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default | Yes |
Default severity | Warning |
Introduced in version | 3.3.0 |
A method marked with [TestInitialize]
should have valid layout.
Methods marked with [TestInitialize]
should follow the following layout to be valid:
- it should be
public
- it should not be
abstract
- it should not be
async void
- it should not be
static
- it should not be a special method (finalizer, operator...).
- it should not be generic
- it should not take any parameter
- return type should be
void
,Task
orValueTask
[!INCLUDE test-class-rules]
Ensure that the method matches the layout described above.
Do not suppress a warning from this rule. If you ignore this rule, flagged instances will be either skipped or result in runtime error.