Render Given/When/Then into Cratis specifications - #36
Conversation
A specification exercising the slice's own command renders as a CommandScenario<T> spec - one file each, in the when_ folder layout the conventions use, wrapped in #if DEBUG. Appended events assert against the event source the command's identifier names; a rejection asserts both that the command failed and that it failed as validation, because ShouldNotBeSuccessful alone cannot tell a rejection from an exception. A specification that cannot be rendered faithfully is not rendered at all and says why. The interesting case is 'given': CommandScenario does support seeding prior events, so the gap is in the document rather than the target - a given event names no event source, and it is frequently not the command's own. A specification asserting that a duplicate invoice number is rejected seeds an InvoiceRegistered for a different invoice than the one it registers, and seeding it against the command's id would assert something else entirely.
|
Reviewer context.
#14's premise is stale, and that changed the design. The issue records "structural gap: Measured on
Before this, Verified by compiling, not by reading. Bite proven. Reverting the A spec defended the old behavior and its premise moved rather than its assertion — Values are type-directed, because a document writes a uuid as text: Not verified: no rendered spec has been executed. It compiles against the real testing assemblies; whether Conflicts with #35 in |
Added
specificationexercising its slice's command renders as a Cratis spec — aCommandScenario<T>in thewhen_folder layout, wrapped in#if DEBUG. Appended events are asserted against the event source the command's identifier names, narrowed to the values the specification states; a rejection asserts both that the command failed and that it failed as validation. (Render Given/When/Then into Cratis Specifications #14)Changed
given, states read model state, exercises another slice's command, or asserts nothing. (Render Given/When/Then into Cratis Specifications #14)