Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Property | Value |
---|---|
Rule ID | MSTEST0044 |
Title | Prefer TestMethod over DataTestMethod |
Category | Design |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default | Yes |
Default severity | Warning |
Introduced in version | 3.10.0 |
Is there a code fix | Yes |
Cause
A method or type uses DataTestMethodAttribute or inherits from it.
Rule description
DataTestMethodAttribute provides no additional value over TestMethodAttribute and will be removed in a future version. Use TestMethodAttribute instead for all test methods, including those that use data source attributes like DataRowAttribute.
How to fix violations
Use the provided code fixer to automatically replace DataTestMethodAttribute with TestMethodAttribute. You can also manually replace the attribute if needed. If you have a custom attribute that inherits from DataTestMethodAttribute, change it to inherit from TestMethodAttribute instead.
When to suppress warnings
Don't suppress warnings from this rule. DataTestMethodAttribute will be removed in a future version, so you should migrate to TestMethodAttribute.