public void TestMethod1() { Configure(); var targetEvent = new TestEvent { Data = string.Format("Testing_{0}", Environment.TickCount) }; this.WaitHandle = new ManualResetEvent(false); var completedHandler = new SubscriberCompletedExecutionHandler( delegate(ISubscriber sub, object target) { var testingEvent = target as TestEvent; Assert.IsNotNull(testingEvent); this.WaitHandle.Set(); }); Subscribers.Current .WithCreator(this.Creator) .WithAssembly <TestEvent>() .Subscribe <TestEvent>() .WithSubscriberCompletedAction(completedHandler); Publishers.Current .WithCreator(this.Creator) .WithAssembly <TestEvent>() .Publish <TestEvent>(targetEvent); this.WaitHandle.WaitOne(); Assert.IsTrue(targetEvent.Processed, "Event wasn't handled during the unit test"); }
public Subscribers WithSubscriberCompletedAction(SubscriberCompletedExecutionHandler handler) { this.SubscriberCompletedExecution += handler; return(this); }