There’s no point in having a test class without any test methods.This could lead a maintainer to assume a class is covered by tests even though it is not.
Supported test frameworks are NUnit and MSTest (not applicable to xUnit).
This rule will raise an issue when any of these conditions are met:
TestFixture but does not contain any method marked with Test,
TestCase, TestCaseSource or Theory. TestClass but does not contain any method marked with TestMethod
or DataTestMethod.
[TestFixture]
public class SomeClassTest { } // Noncompliant - no test
[TestClass]
public class SomeOtherClassTest { } // Noncompliant - no test
[TestFixture]
public class SomeClassTest
{
[Test]
public void SomeMethodShouldReturnTrue() { }
}
[TestClass]
public class SomeOtherClassTest
{
[TestMethod]
public void SomeMethodShouldReturnTrue() { }
}
AssemblyInitialize or AssemblyCleanup.