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

name string

The 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

name string

The non-empty header name matched without regard to case.

expectedValue string

The 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

expected T

The value serialized immediately and compared structurally with the recorded JSON payload. It is not retained or owned and may be null.

options JsonSerializerOptions

Serialization 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

T

The type of expected value serialized for comparison.

Exceptions

RecordedMessageVerificationException

The JSON values differ structurally. The exception message includes both payloads without automatic redaction.