An MSTest [TestClass] is not public, so none of its tests run

tx0/csharp:test-class-not-publicdefaultwarningmaintainability/testsdepth fastbug

What it finds

MSTest looks for test classes among public types only. A [TestClass] that is internal, or private when nested, compiles and none of its tests are run.

From the rule's source, test_class_not_public.rs.

Example from the rule's tests
using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass]class ParserTeststx0 reports: the test class ParserTests is not public and none of its tests run{    [TestMethod]    public void Parses() { }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:test-class-not-public" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:test-class-not-public] reason="..."

tx0 explain tx0/csharp:test-class-not-public shows the same in the terminal. Found a false positive? Report it.