public void TestStopAndStart() { var countdownEvent = new CountdownEvent(2); var eventDispatcher = new TestEventDispatcher(countdownEvent); SetEventProcessor(eventDispatcher); UserEvent userEvent = BuildConversionEvent(EventName); EventProcessor.Process(userEvent); eventDispatcher.ExpectConversion(EventName, TestUserId); Thread.Sleep(1500); Assert.True(eventDispatcher.CompareEvents()); EventProcessor.Stop(); EventProcessor.Process(userEvent); eventDispatcher.ExpectConversion(EventName, TestUserId); EventProcessor.Start(); EventProcessor.Stop(); Assert.True(countdownEvent.Wait(TimeSpan.FromMilliseconds(MAX_DURATION_MS * 3)), "Exceeded timeout waiting for notification."); }