public void TestBasicHandler()
 {
     bool handled = false;
     var handler = new SimpleEventHandler<MyTestCommand>(
         (cmd, seq, endOfBatch) =>
         {
             handled = true;
         });
     handler.OnNext(new MyTestCommand(), 0, false);
     Assert.That(handled, Is.True);
 }
        public void TestServiceHandler()
        {
            bool handled = false;
            DateTimeOffset eventTime = DateTimeOffset.UtcNow;
            var clockMock = new Mock<IUtcClockService>();
            clockMock
                .SetupGet(o => o.UtcNow)
                .Returns(new DateTimeOffset(new DateTime(2016, 04, 01)));

            var handler = new SimpleEventHandler<IUtcClockService, MyTestCommand>(clockMock.Object,
                (businessLogic, cmd, seq, endOfBatch) =>
                {
                    eventTime = businessLogic.UtcNow;
                    handled = true;
                });
            handler.OnNext(new MyTestCommand(), 0, false);
            Assert.That(handled, Is.True);
            Assert.That(eventTime, Is.EqualTo(new DateTimeOffset(new DateTime(2016, 04, 01))));
        }