Class RecordingEventDispatcherService
IEventDispatcherService implementation that both records every dispatched
signal for assertions and delivers it to subscribers, so a test can assert on what a service
broadcast and drive an EventDispatcherAction through the same instance.
Inheritance
RecordingEventDispatcherService
Assembly: Tests.dll
Syntax
public class RecordingEventDispatcherService : IEventDispatcherService, IService, IFoundationSettings
Constructors
RecordingEventDispatcherService()
Declaration
public RecordingEventDispatcherService()
Properties
DispatchedSignals
Every signal dispatched through this instance, in dispatch order. Each read takes a
snapshot copy under the lock, so it is safe to read while a concurrent dispatch is in
flight.
Declaration
public IReadOnlyList<EventDispatcherSignal> DispatchedSignals { get; }
Property Value
Guid
Declaration
public string Guid { get; set; }
Property Value
Id
Declaration
public string Id { get; set; }
Property Value
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
ReenterOnDispatch
When set, fires exactly once — on the first call to
Dispatch(EventDispatcherSignal, Type) after being set — so a test can stand
in for a subscriber that re-enters the dispatcher synchronously (the input-map re-switch
that re-fires a held Submit). The callback receives this instance so it can dispatch again;
the one-shot latch stops that nested dispatch from re-triggering the callback.
Declaration
public Action<RecordingEventDispatcherService> ReenterOnDispatch { get; set; }
Property Value
SubscribedSignalTypes
Every type Subscribe<T>(EventDispatcherSignalDelegate) was called for, in call order and with repeats
kept, so a test can assert that a binder subscribed exactly once per type. Each read
takes a snapshot copy under the lock.
Declaration
public IReadOnlyList<Type> SubscribedSignalTypes { get; }
Property Value
ThrowOnDispatch
When set, every call to Dispatch(EventDispatcherSignal, Type) throws this
exception instead of recording the signal, so a test can prove a caller releases its
guards (locks, gates) from a finally rather than only on the happy path.
Declaration
public Exception ThrowOnDispatch { get; set; }
Property Value
UnsubscribedSignalTypes
Declaration
public IReadOnlyList<Type> UnsubscribedSignalTypes { get; }
Property Value
Methods
Dispatch(IEventDispatcherSignalDefinition)
Declaration
public void Dispatch(IEventDispatcherSignalDefinition signalDefinition)
Parameters
Dispatch(EventDispatcherSignal, Type)
Declaration
public void Dispatch(EventDispatcherSignal signal, Type type)
Parameters
Dispatch<T>(T)
Declaration
public void Dispatch<T>(T signal) where T : EventDispatcherSignal
Parameters
| Type |
Name |
Description |
| T |
signal |
|
Type Parameters
SignalsOf<TSignal>()
The signals of a given type dispatched through this instance, in dispatch order.
Declaration
public IReadOnlyList<TSignal> SignalsOf<TSignal>() where TSignal : EventDispatcherSignal
Returns
Type Parameters
| Name |
Description |
| TSignal |
The signal type to filter by.
|
Subscribe<T>(EventDispatcherSignalDelegate)
Declaration
public void Subscribe<T>(EventDispatcherSignalDelegate callback) where T : EventDispatcherSignal
Parameters
Type Parameters
Unsubscribe<T>(EventDispatcherSignalDelegate)
Declaration
public void Unsubscribe<T>(EventDispatcherSignalDelegate callback) where T : EventDispatcherSignal
Parameters
Type Parameters
Implements