Exceptions
The family the library throws on its own behalf, and which member appears for which kind of refusal.
sealed class
AnyGenerationException
Thrown when a generation cannot be completed even though every declared constraint was accepted — most commonly when a factory passed to As or a composer passed to Combine rejects a generated value. Whenever the failing generator draws from one of the library's random contexts, the message names the seed that replays the run and Seed carries it.
public sealed class AnyGenerationException- Extends
DummyException- Implements
ISerializable
Constructors
AnyGenerationException(string message) | Initializes a new instance of the AnyGenerationException class. |
|---|---|
AnyGenerationException(string message, Exception innerException) | Initializes a new instance of the AnyGenerationException class wrapping an underlying failure. |
Properties
int? Seed { get; } | The seed of the random context the failing generation drew from, when it is known. Under the ambient context (Any.Reproducibly(...)) pass it to Any.Reproducibly(seed, ...) to replay the run; a value drawn from an Any.WithSeed(seed) context already replays deterministically on its own. The failure message states which of the two applies. null when the failing generator does not draw from one of the library's random contexts. |
|---|
sealed class
ConflictingAnyConstraintException
Thrown at the moment a constraint is declared when it cannot be satisfied together with the constraints already declared on the same generator — for example Any.String().WithLength(3).StartingWith("ORD-"), where the prefix alone already requires 4 characters. Failing at declaration time, with a message that names both constraints, is a deliberate part of the library's contract: a contradiction in a test's Arrange is a defect of the test, and it should read as one — not surface later as a puzzling generation failure.
public sealed class ConflictingAnyConstraintException- Extends
DummyException- Implements
ISerializable
Constructors
ConflictingAnyConstraintException(string message) | Initializes a new instance of the ConflictingAnyConstraintException class. |
|---|
abstract class
DummyException
Base class of every exception the library throws on its own behalf, so a caller can catch "anything JustDummies rejected" with a single clause. Concrete cases: ConflictingAnyConstraintException when two declared constraints cannot be satisfied together, and AnyGenerationException when a generation fails even though the constraints were accepted.
public abstract class DummyException- Extends
Exception- Implements
ISerializable
sealed class
UnsupportedRegexException
Thrown when a pattern passed to StringMatching is well-formed but uses a construct outside the regular subset the library generates from — a lookahead or lookbehind, a backreference, a balancing group, a Unicode category, a word boundary. These constructs are either not regular (so no finite generator can honour them) or deliberately out of scope; the library refuses to guess rather than silently emit a value that does not actually match. A syntactically malformed pattern is a caller mistake and surfaces as an ArgumentException instead.
public sealed class UnsupportedRegexException- Extends
DummyException- Implements
ISerializable
Constructors
UnsupportedRegexException(string message) | Initializes a new instance of the UnsupportedRegexException class. |
|---|