JustDummies

Just dummies — but seriously powerful ones.

Documentation sections

JD013: HeldCollectionPassedToOneOf

PropertyValue
CategoryUsage (JustDummies.Usage)
Severity🟠 Warning
Enabled by defaultYes

Any.OneOf takes params T[]. A single List<Order> argument therefore binds T = List<Order>, not Order: the pool holds one item, every draw returns the same list, and the arbitrary choice the test claims to make never varies. Nothing fails — the call compiles, the draws succeed, and the test is simply less arbitrary than it reads.

ADR-0011 opens in a new tab recorded this as an accepted risk, “mitigated by ElementOf being the documented path”. This rule turns that mitigation from a documentation hope into a check.

Any.ElementOf is the entry point that takes a collection and draws from its elements.

Noncompliant

List<Order> orders = ...;
IAny<List<Order>> pool = Any.OneOf(orders);   // JD013: a pool of one — every draw is the same list

Compliant

List<Order> orders = ...;
IAny<Order> pool = Any.ElementOf(orders);

What it does not flag

  • Any.OneOf<List<Order>>(orders) — an explicit type argument states the opposite intent, and is the documented way to say “a pool whose single element is that collection”.
  • A single string, which is IEnumerable<char>: a one-string pool is ordinary.
  • An array. An array satisfies params directly, so T is already inferred as the element type and the call is correct as written.
  • Two or more arguments, which cannot produce the confusion.

Read the source, or correct it there opens in a new tab· Mirrored from lib-v1.0.0-preview.6