A method marked as a test is not public, so the test framework does not run it
What it finds
xUnit, NUnit and MSTest discover only public test methods; a private or internal method with [Fact], [Test] or [TestMethod] compiles and is silently skipped, so whatever it checks is never checked.
From the rule's source, test_method_not_public.rs.
using Xunit; public class MathTests{ [Fact] void Adds()tx0 reports: the test Adds is not public and never runs { Assert.Equal(2, 1 + 1); } [Fact] public void Subtracts() { Assert.Equal(0, 1 - 1); }} 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:
[rules]
"tx0/csharp:test-method-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-method-not-public] reason="..."tx0 explain tx0/csharp:test-method-not-public shows the same in the terminal. Found a false positive? Report it.