public void AsyncEventHadlerTest() { var dispatcher = new EventDispatcher(_logFactory, "testBC"); var asyncHandler = new AsyncEventHandler(false); bool ack = false; dispatcher.Wire("testBC", asyncHandler); dispatcher.Dispatch("testBC", "test", (delay, acknowledge) => { ack = acknowledge; }); Assert.AreEqual(1, asyncHandler.HandledEvents.Count); Assert.True(ack, "Event handler was not processed properly"); }
public void ExceptionForAsyncEventHadlerTest() { var dispatcher = new EventDispatcher(_logFactory, "testBC"); var handler = new AsyncEventHandler(true); int failedCount = 0; dispatcher.Wire("testBC", handler); dispatcher.Dispatch("testBC", "test", (delay, acknowledge) => { if (!acknowledge) { ++failedCount; } }); Assert.AreEqual(0, handler.HandledEvents.Count); Assert.AreEqual(1, failedCount, "Event handler was not processed properly"); }