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 |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains
|
WaitUntilAllMessagesAreConsumedAsync(Boolean, Nullable<TimeSpan>)
Returns a System.Threading.Tasks.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 |
---|---|---|
System.Boolean | throwTimeoutException | A value specifying whether a System.TimeoutException has to be thrown when the messages aren't consumed before the timeout expires. |
System.Nullable<System.TimeSpan> | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that completes when all messages have been processed. |
Remarks
This method works with the mocked brokers only.
WaitUntilAllMessagesAreConsumedAsync(Nullable<TimeSpan>)
Returns a System.Threading.Tasks.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 |
---|---|---|
System.Nullable<System.TimeSpan> | timeout | The time to wait for the messages to be consumed and processed. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that completes when all messages have been processed. |
Remarks
This method works with the mocked brokers only.
WaitUntilConnectedAsync(Boolean, Nullable<TimeSpan>)
Returns a System.Threading.Tasks.Task that completes when all consumers are connected and ready.
Declaration
Task WaitUntilConnectedAsync(bool throwTimeoutException, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | throwTimeoutException | A value specifying whether a System.TimeoutException has to be thrown when the connection isn't established before the timeout expires. |
System.Nullable<System.TimeSpan> | timeout | The time to wait for the consumers to connect. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that completes when all consumers are successfully connected and ready. |
WaitUntilConnectedAsync(Nullable<TimeSpan>)
Returns a System.Threading.Tasks.Task that completes when all consumers are connected and ready.
Declaration
Task WaitUntilConnectedAsync(TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.TimeSpan> | timeout | The time to wait for the consumers to connect. The default is 30 seconds. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that completes when all consumers are successfully connected and ready. |
WaitUntilOutboxIsEmptyAsync(CancellationToken)
Returns a System.Threading.Tasks.Task that completes when all messages stored in the outbox have been produced.
Declaration
Task WaitUntilOutboxIsEmptyAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that completes when the outbox is empty. |