Class EventReceiver<TEvent>
the default implementation of an event receiver that can be used to test the execution of and event.
Implements
IEventReceiver<TEvent>
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Core.dll
Syntax
public sealed class EventReceiver<TEvent> : IEventReceiver<TEvent> where TEvent : notnull
Type Parameters
| Name | Description |
|---|---|
| TEvent | the type of the event |
Methods
WaitForMatchAsync(Func<TEvent, bool>, int, CancellationToken)
waits until at least one matching event is received not exceeding the timeout period.
Declaration
public Task<IEnumerable<TEvent>> WaitForMatchAsync(Func<TEvent, bool> match, int timeoutSeconds = 2, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TEvent, bool> | match | a predicate for matching events that should be returned by the method |
| int | timeoutSeconds | how long the method will wait until a matching event is received. default value is 2 seconds |
| CancellationToken | ct | optional cancellation token |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<TEvent>> |