Class InboundEnvelopeBuilder<TMessage>
Creates the IInboundEnvelope<TMessage> instances to be used for testing.
Inherited Members
Namespace: Silverback.Messaging.Messages
Assembly: Silverback.Integration.Testing.dll
Syntax
public class InboundEnvelopeBuilder<TMessage> where TMessage : class
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the wrapped message. |
Constructors
InboundEnvelopeBuilder()
Creates the IInboundEnvelope<TMessage> instances to be used for testing.
Declaration
public InboundEnvelopeBuilder()
Methods
AddHeader(MessageHeader)
Adds a header to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> AddHeader(MessageHeader header)
Parameters
| Type | Name | Description |
|---|---|---|
| MessageHeader | header | The header to be added. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
AddHeader(string, object?)
Adds a header to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> AddHeader(string name, object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the header. |
| object | value | The value of the header. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
AddHeader(string, string?)
Adds a header to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> AddHeader(string name, string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the header. |
| string | value | The value of the header. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
AddOrReplaceHeader(string, object?)
Adds a header to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> AddOrReplaceHeader(string name, object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the header. |
| object | value | The value of the header. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
AddOrReplaceHeader(string, string?)
Adds a header to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> AddOrReplaceHeader(string name, string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the header. |
| string | value | The value of the header. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
Build()
Builds the IInboundEnvelope<TMessage> instance.
Declaration
public IInboundEnvelope<TMessage> Build()
Returns
| Type | Description |
|---|---|
| IInboundEnvelope<TMessage> | The IInboundEnvelope<TMessage> instance. |
WithConsumer(IConsumer?)
Sets the consumer that consumed the message.
Declaration
public InboundEnvelopeBuilder<TMessage> WithConsumer(IConsumer? consumer)
Parameters
| Type | Name | Description |
|---|---|---|
| IConsumer | consumer | The consumer. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
WithEndpoint(ConsumerEndpoint?)
Sets the endpoint from which the message was consumed.
Declaration
public InboundEnvelopeBuilder<TMessage> WithEndpoint(ConsumerEndpoint? endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsumerEndpoint | endpoint | The endpoint. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
WithHeaders(IReadOnlyCollection<MessageHeader>?)
Sets the headers to be added to the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> WithHeaders(IReadOnlyCollection<MessageHeader>? headers)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<MessageHeader> | headers | The headers to be added. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
WithIdentifier(IBrokerMessageIdentifier)
Sets the identifier of the message.
Declaration
public InboundEnvelopeBuilder<TMessage> WithIdentifier(IBrokerMessageIdentifier identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrokerMessageIdentifier | identifier | The identifier. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
WithMessage(TMessage?)
Sets the message to be wrapped by the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> WithMessage(TMessage? message)
Parameters
| Type | Name | Description |
|---|---|---|
| TMessage | message | The message to be wrapped. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |
WithRawMessage(Stream?)
Sets the raw message to be wrapped by the envelope.
Declaration
public InboundEnvelopeBuilder<TMessage> WithRawMessage(Stream? rawMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | rawMessage | The raw message to be wrapped. |
Returns
| Type | Description |
|---|---|
| InboundEnvelopeBuilder<TMessage> | The InboundEnvelopeBuilder<TMessage> so that additional calls can be chained. |