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

NameSignatureSynopsis
CommandTestEnvelope.Command(details)Wrap a command payload in a Command envelope using the system clock.
CommandTestEnvelope.Command(details, timeProvider)Wrap a command payload in a Command envelope, stamping CreationDate from the given TimeProvider.
EventTestEnvelope.Event(details, version)Wrap an event payload in an Event envelope using the system clock.
EventTestEnvelope.Event(details, version, timeProvider)Wrap an event payload in an Event envelope carrying the given version, stamping CreationDate from the given TimeProvider.

Command

TestEnvelope.Command(details)
Member
Wrap a command payload in a Command envelope using the system clock.

Parameters

NameTypeDescription
details'T

Returns

Command<'T>

Command

TestEnvelope.Command(details, timeProvider)
Member
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

NameTypeDescription
details'T
timeProviderTimeProvider

Returns

Command<'T>

Event

TestEnvelope.Event(details, version)
Member
Wrap an event payload in an Event envelope using the system clock.

Parameters

NameTypeDescription
details'T
versionint64

Returns

Event<'T>

Event

TestEnvelope.Event(details, version, timeProvider)
Member
Wrap an event payload in an Event envelope carrying the given version, stamping CreationDate from the given TimeProvider.

Parameters

NameTypeDescription
details'T
versionint64
timeProviderTimeProvider

Returns

Event<'T>