diff --git a/_rules/1602.md b/_rules/1602.md new file mode 100644 index 00000000..71d91255 --- /dev/null +++ b/_rules/1602.md @@ -0,0 +1,23 @@ +--- +rule_id: 1602 +rule_category: testability +title: Postfix test classes with `Specs` instead of `Tests` +severity: 3 +--- +The suffix `Specs` signals that a class describes the observable behavior (specifications) of a component, not just a set of mechanical tests. This encourages a behavior-driven mindset. + +```csharp +// Avoid +public class OrderServiceTests { ... } + +// Prefer +public class OrderServiceSpecs { ... } + +// Or nest specs per scenario +public class OrderServiceSpecs +{ + public class OrderPlacement { ... } +} +``` + +Nested classes group related scenarios together and make the test report more readable.