I am trying to run some initialization code before the test. I tried suggestions on other issues , but it doesn't seem to work. My domain model fires events through the following class:
public static class DomainEvents
{
private static readonly object @lock = new object();
private static Action<IDomainEvent> raiseEvent;
public static void Raise<TEvent>(TEvent @event) where TEvent : class, IDomainEvent
{
}
public static void RegisterEventPublisher(Action<IDomainEvent> eventPublisher)
{
lock (@lock)
{
raiseEvent = eventPublisher;
}
}
}
For testing purposes, I would like to capture these events in a static list. What is the best way to do this?
Update
(, , ). . , , , ) , ( "" ) ) , ( ).
- . , ICleanupAfterEveryContextInAssembly.