| Property | Value |
|---|---|
| Category | Usage (JustDummies.Usage) |
| Severity | 🔴 Error |
| Enabled by default | Yes |
A generator is an immutable recipe, not a value — and no JustDummies generator overrides ToString(). Rendering one as text therefore yields the builder’s CLR type name: $"{Any.String()}" produces the literal string "JustDummies.AnyString".
That string is non-empty, plausible-looking, and identical on every run. It flows into the message, the payload or the value object under test as if it were an arbitrary value, so the test goes green while exercising a constant that varies for nobody — the exact opposite of what Any is for. Nothing warns: the conversion is legal C#.
Materialize the value with Generate().
Noncompliant
string message = $"order {Any.String().NonEmpty()}"; // JD005: "order JustDummies.AnyString"
string reference = "ORD-" + Any.String().NonEmpty(); // JD005
string quantity = Any.Int32().Positive().ToString(); // JD005: "JustDummies.AnyInt32"
Compliant
string message = $"order {Any.String().NonEmpty().Generate()}";
string reference = "ORD-" + Any.String().NonEmpty().Generate();
string quantity = Any.Int32().Positive().Generate().ToString();
What it does not flag
- A generated value —
Generate()returns the value, and rendering it is the point. - A consumer’s own generator that meaningfully overrides
ToString(): the call resolves to that override rather than toobject.ToString(), and is deliberately left alone. - A
ToString(...)overload taking a format or a culture — that is neverobject.ToString().