GetEventHandlersFromAggregateRoot() публичный Метод

Gets the event handlers from aggregate root based on the given mapping.
public GetEventHandlersFromAggregateRoot ( IEventSource eventSource ) : IEnumerable
eventSource IEventSource The aggregate root.
Результат IEnumerable
        public void It_should_not_handle_event_when_there_needs_to_be_an_exact_match_and_event_types_are_derived()
        {
            var aggregate = new EventMappedExactOnMethodWithDerivedEventTypeTarget();
            var mapping = new ExpressionBasedSourcedEventHandlerMappingStrategy();

            var handlers = mapping.GetEventHandlersFromAggregateRoot(aggregate);

            foreach (var handler in handlers)
                handler.HandleEvent(new EventMappedExactOnMethodWithDerivedEventTypeTarget.DerivedEvent()).Should().BeFalse();
        }
        public void It_should_not_handle_event_when_there_is_a_mapping_inheritance_type_mismatch()
        {
            var aggregate = new MismatchOnEventTypeTarget();
            var mapping = new ExpressionBasedSourcedEventHandlerMappingStrategy();

            var handlers = mapping.GetEventHandlersFromAggregateRoot(aggregate);

            foreach (var handler in handlers)
                handler.HandleEvent(new MismatchOnEventTypeTarget.BaseEvent()).Should().BeFalse();
        }
        public void It_should_map_the_mapped_events()
        {
            var aggregate = new GoodTarget();
            var mapping = new ExpressionBasedSourcedEventHandlerMappingStrategy();

            var handlers = mapping.GetEventHandlersFromAggregateRoot(aggregate);

            handlers.Count().Should().Be(4);
            handlers.Should().OnlyHaveUniqueItems();
        }
        public void It_should_create_the_correct_event_handlers()
        {
            var aggregate = new GoodTarget();
            var mapping = new ExpressionBasedSourcedEventHandlerMappingStrategy();

            var handlers = mapping.GetEventHandlersFromAggregateRoot(aggregate);

            foreach (var handler in handlers)
            {
                handler.HandleEvent(new GoodTarget.PublicEvent());
                handler.HandleEvent(new GoodTarget.ProtectedEvent());
                handler.HandleEvent(new GoodTarget.InternalEvent());
                handler.HandleEvent(new GoodTarget.PrivateEvent());
            }

            aggregate.PublicEventHandlerInvokeCount.Should().Be(1);
            aggregate.ProtectedEventHandlerInvokeCount.Should().Be(1);
            aggregate.InternalEventHandlerInvokeCount.Should().Be(1);
            aggregate.PrivateEventHandlerInvokeCount.Should().Be(1);
        }
        public void It_should_throw_an_exception_when_mapped_method_is_static()
        {
            var aggregate = new IlligalStaticMethodTarget();
            var mapping = new ExpressionBasedSourcedEventHandlerMappingStrategy();

            Action act = () => mapping.GetEventHandlersFromAggregateRoot(aggregate);
            act.ShouldThrow<InvalidEventHandlerMappingException>();
        }