Example #1
0
        public void ShouldHandleEmptyListOfEventHandlers()
        {
            var aggregateEventHandler = new AggregateEventHandler <int[]>();

            aggregateEventHandler.OnNext(new[] { 7 }, 0L, true);
            aggregateEventHandler.OnStart();
            aggregateEventHandler.OnShutdown();
        }
Example #2
0
        public void ShouldCallOnEvent()
        {
            var        evt        = new[] { 7 };
            const long sequence   = 3L;
            const bool endOfBatch = true;

            var aggregateEventHandler = new AggregateEventHandler <int[]>(_eventHandlerMock1.Object,
                                                                          _eventHandlerMock2.Object,
                                                                          _eventHandlerMock3.Object);

            _eventHandlerMock1.Setup(eh => eh.OnNext(evt, sequence, endOfBatch)).Verifiable("event handler 1 was not called");
            _eventHandlerMock2.Setup(eh => eh.OnNext(evt, sequence, endOfBatch)).Verifiable("event handler 2 was not called");
            _eventHandlerMock3.Setup(eh => eh.OnNext(evt, sequence, endOfBatch)).Verifiable("event handler 3 was not called");

            aggregateEventHandler.OnNext(evt, sequence, endOfBatch);

            _eventHandlerMock1.Verify();
            _eventHandlerMock2.Verify();
            _eventHandlerMock3.Verify();
        }