TestEnvelopeType
PackageFCQRS
C#-friendly builders for the Command/Event envelopes that the pure
handleCommand/applyEvent functions expect. Intended for unit tests: the
envelope's plumbing fields (a fresh MessageId/CID, a UTC timestamp, no
sender, empty metadata) are filled in for you, so a test supplies only the
payload and, for events, the aggregate version. The framework builds these
envelopes itself at runtime; tests are the one place you build them by hand.
Specification
Kind
Type
Members
4
Examples
0
CommandSignature
TestEnvelope.Command(details)
CommandSignature
TestEnvelope.Command(details, timeProvider)
EventSignature
TestEnvelope.Event(details, version)
EventSignature
TestEnvelope.Event(details, version, timeProvider)
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Command | TestEnvelope.Command(details) | Wrap a command payload in a Command envelope using the system clock. |
| Command | TestEnvelope.Command(details, timeProvider) | Wrap a command payload in a Command envelope, stamping CreationDate from the given TimeProvider. |
| Event | TestEnvelope.Event(details, version) | Wrap an event payload in an Event envelope using the system clock. |
| Event | TestEnvelope.Event(details, version, timeProvider) | Wrap an event payload in an Event envelope carrying the given version, stamping CreationDate from the given TimeProvider. |
Wrap a command payload in a Command envelope using the system clock.
Parameters
| Name | Type | Description |
|---|---|---|
| details | 'T |
Returns
Command<'T>
Wrap a command payload in a Command envelope, stamping CreationDate from
the given TimeProvider. Pass a FakeTimeProvider to test time-dependent
decision logic (e.g. sliding-window quotas) deterministically.
Parameters
| Name | Type | Description |
|---|---|---|
| details | 'T | |
| timeProvider | TimeProvider |
Returns
Command<'T>
Wrap an event payload in an Event envelope using the system clock.
Parameters
| Name | Type | Description |
|---|---|---|
| details | 'T | |
| version | int64 |
Returns
Event<'T>