Class RecordedMessageAssertions
- Namespace
- XBullet.EasyTesting.Messaging
- Assembly
- XBullet.EasyTesting.Messaging.dll
Fluently verifies one recorded message.
public sealed class RecordedMessageAssertions
- Inheritance
-
RecordedMessageAssertions
- Inherited Members
Methods
HaveHeader(string)
Requires the message to contain the supplied header.
public RecordedMessageAssertions HaveHeader(string name)
Parameters
namestringThe non-empty header name matched without regard to case.
Returns
- RecordedMessageAssertions
This message assertion object so additional checks can be chained.
Exceptions
- RecordedMessageVerificationException
The header is absent.
HaveHeader(string, string)
Requires the message to contain the supplied header value.
public RecordedMessageAssertions HaveHeader(string name, string expectedValue)
Parameters
namestringThe non-empty header name matched without regard to case.
expectedValuestringThe non-null value compared using ordinal, case-sensitive comparison. An empty value is accepted. Failed assertions include expected and actual values without redaction.
Returns
- RecordedMessageAssertions
This message assertion object so additional checks can be chained.
Exceptions
- RecordedMessageVerificationException
The header is absent or its value differs.
HavePayload<T>(T, JsonSerializerOptions?)
Requires the message payload to structurally equal the supplied JSON value.
public RecordedMessageAssertions HavePayload<T>(T expected, JsonSerializerOptions? options = null)
Parameters
expectedTThe value serialized immediately and compared structurally with the recorded JSON payload. It is not retained or owned and may be null.
optionsJsonSerializerOptionsSerialization options for
expected, or null to use the recording bus's options. Supplied options are read but not owned, retained, or mutated.
Returns
- RecordedMessageAssertions
This message assertion object so additional checks can be chained.
Type Parameters
TThe type of expected value serialized for comparison.
Exceptions
- RecordedMessageVerificationException
The JSON values differ structurally. The exception message includes both payloads without automatic redaction.