Esempio n. 1
0
        public void AsyncResultEventHadlerTest()
        {
            var  dispatcher = new EventDispatcher(_logFactory, "testBC");
            var  handler    = new EventAsyncResultHandler(false);
            bool ack        = false;

            dispatcher.Wire("testBC", handler);
            dispatcher.Dispatch("testBC", "test", (delay, acknowledge) => { ack = acknowledge; });

            Assert.AreEqual(1, handler.HandledEvents.Count);
            Assert.True(ack, "Event handler was not processed properly");
        }
Esempio n. 2
0
        public void ExceptionForAsyncResultEventHadlerTest()
        {
            var dispatcher  = new EventDispatcher(_logFactory, "testBC");
            var handler     = new EventAsyncResultHandler(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");
        }