Interface IEventReceiver<TEvent>
interface for an event receiver that can be used to test the receipt of events in testing.
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Core.dll
Syntax
public interface IEventReceiver<TEvent> where TEvent : notnull
Type Parameters
Name | Description |
---|---|
TEvent | the type of the event |
Methods
AddEvent(TEvent)
Declaration
void AddEvent(TEvent evnt)
Parameters
Type | Name | Description |
---|---|---|
TEvent | evnt |
WaitForMatchAsync(Func<TEvent, bool>, int, CancellationToken)
waits until at least one matching event is received not exceeding the timeout period.
Declaration
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>> |