Maintain code quality of unit tests
One of the most powerful ReSharper for Visual Studio Code features — code inspection — comes in handy when you write unit tests. In addition to hundreds of general-purpose inspections, there is also a number of dedicated inspections that target problems specific to unit tests:
NUnit (30 inspections)
These inspections detect code issues related to NUnit tests.
Inspection | |
|---|---|
NUnit. Async test method must return Task or Task<T> | |
NUnit. Duplicate values. | |
NUnit. Ignored parameter attribute. | |
NUnit. Implicitly unspecified null values. | |
NUnit. Incompatible argument type or incorrect argument value. | |
NUnit. Incompatible expected result type or incorrect value. | |
NUnit. Incorrect range bounds. 'to' must be greater than or equal to 'from'. | |
NUnit. Mismatch of the range step sign. | |
NUnit. Missing arguments in TestCase attribute. | |
NUnit. Missing 'CancelAfter' attribute on test method declaration. | |
NUnit. Missing expected result for non-void test method. | |
NUnit. No values provided in the attributes. | |
NUnit. Non-public test method. | |
NUnit. Range 'step' parameter value must be non-zero. | |
NUnit. Redundant argument in TestCase attribute. | |
NUnit. Redundant argument instead of ExpectedResult. | |
NUnit. Redundant expected result for void test method. | |
NUnit. Specified attribute values produce too many tests. | Disabled |
NUnit. Specified values are not compatible with the test parameter type. | |
NUnit. Test case Result property duplicates ExpectedResult. | |
NUnit. Test case Result property is obsolete. | |
NUnit. Test case source must be field, property, or method. | |
NUnit. Test case source must be non-abstract and implement IEnumerable. | |
NUnit. Test case source must be static. | |
NUnit. The maximum range value is not reachable with the step value. | |
NUnit. Values for test method parameters are not provided. | |
NUnit. Values in range do not fit the type of the test parameter. | |
NUnit.AutoFixture. Incompatible argument type or incorrect argument value. | |
NUnit.AutoFixture. Missing Test or TestFixture attribute. | |
NUnit.AutoFixture. Redundant argument in InlineAutoData attribute. |
Xunit (1 inspection)
These inspections detect code issues related to xUnit.Net tests.
Inspection | |
|---|---|
Console output in Xunit tests |