Interface ITestingHelper<TBroker>
Exposes some helper methods and shortcuts to simplify testing.
Namespace: Silverback.Testing
Assembly: Silverback.Integration.Testing.dll
Syntax
public interface ITestingHelper<out TBroker> where TBroker : IBroker
Type Parameters
Name | Description |
---|---|
TBroker | The IBroker implementation. |
Properties
| Improve this doc View sourceBroker
Gets the current IBroker instance.
Declaration
TBroker Broker { get; }
Property Value
Type | Description |
---|---|
TBroker |
Spy
Gets the IIntegrationSpy.
Declaration
IIntegrationSpy Spy { get; }
Property Value
Type | Description |
---|---|
IIntegrationSpy |
Remarks
The IIntegrationSpy must be enabled calling AddIntegrationSpy
or
AddIntegrationSpyAndSubscriber
.
Methods
| Improve this doc View sourceIsOutboxEmptyAsync()
Checks whether the outbox (table) is empty.
Declaration
Task<bool> IsOutboxEmptyAsync()
Returns
Type | Description |
---|---|
Task<bool> | A Task<TResult> representing the asynchronous operation. The task result contains
|
WaitUntilAllMessagesAreConsumedAsync(bool, TimeSpan?)
Returns a Task that completes when all messages routed to the consumers have been processed and committed.
Declaration
Task WaitUntilAllMessagesAreConsumedAsync(bool throwTimeoutException, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
bool | throwTimeoutException | A value specifying whether a TimeoutException has to be thrown when the messages aren't consumed before the timeout expires. |
TimeSpan? | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
Task | A Task that completes when all messages have been processed. |
Remarks
This method works with the mocked brokers only.
WaitUntilAllMessagesAreConsumedAsync(TimeSpan?)
Returns a Task that completes when all messages routed to the consumers have been processed and committed.
Declaration
Task WaitUntilAllMessagesAreConsumedAsync(TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan? | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
Task | A Task that completes when all messages have been processed. |
Remarks
This method works with the mocked brokers only.
WaitUntilConnectedAsync(bool, TimeSpan?)
Returns a Task that completes when all consumers are connected and ready.
Declaration
Task WaitUntilConnectedAsync(bool throwTimeoutException, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
bool | throwTimeoutException | A value specifying whether a TimeoutException has to be thrown when the connection isn't established before the timeout expires. |
TimeSpan? | timeout | The time to wait for the consumers to connect. The default is 30 seconds. |
Returns
Type | Description |
---|---|
Task | A Task that completes when all consumers are successfully connected and ready. |
WaitUntilConnectedAsync(TimeSpan?)
Returns a Task that completes when all consumers are connected and ready.
Declaration
Task WaitUntilConnectedAsync(TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan? | timeout | The time to wait for the consumers to connect. The default is 30 seconds. |
Returns
Type | Description |
---|---|
Task | A Task that completes when all consumers are successfully connected and ready. |
WaitUntilOutboxIsEmptyAsync(CancellationToken)
Returns a Task that completes when all messages stored in the outbox have been produced.
Declaration
Task WaitUntilOutboxIsEmptyAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
Task | A Task that completes when the outbox is empty. |