| Property | Value |
|---|---|
| Category | Reproducibility (JustDummies.Reproducibility) |
| Severity | 🟠 Warning |
| Enabled by default | Yes |
xUnit collects BeforeAfterTestAttributes from the test method, its declaring class and the assembly — nowhere else. [Reproducible] on a helper method, on an arrange method, or on a method whose [Fact] was removed during a refactor, is never read: it pins no seed and reports none.
What makes this worth a diagnostic is that a working [Reproducible] is silent by design — a passing test reports nothing. The inert form and the working form are therefore indistinguishable from the outside, right up until a failure that should have named a seed does not.
Remove it, or move it to the level xUnit actually reads.
Noncompliant
public class OrderTests {
[Reproducible] // JD010: never read — this is not a test
private string ArrangeReference() => Any.String().StartingWith("ORD-").Generate();
[Fact]
public void It_is_accepted() { /* uses ArrangeReference() */ }
}
Compliant
[Reproducible] // the class level covers every test it declares
public class OrderTests {
private string ArrangeReference() => Any.String().StartingWith("ORD-").Generate();
[Fact]
public void It_is_accepted() { /* ... */ }
}
What it does not flag
- The attribute on a
[Fact], a[Theory], or any third-party attribute implementing xUnit’sIFactAttribute— the rule keys on that interface, not on a fixed list. - The attribute on a class or on the assembly, which are exactly the levels xUnit does collect.