GetEventHandlersFromAggregateRoot() public method

Gets the event handlers from aggregate root based on attributes.
public GetEventHandlersFromAggregateRoot ( IEventSource eventSource ) : IEnumerable
eventSource IEventSource The aggregate root.
return IEnumerable
        public void It_should_map_the_mapped_events()
        {
            var aggregate = new GoodTarget();
            var mapping = new AttributeBasedDomainSourcedEventHandlerMappingStrategy();

            var handlers = mapping.GetEventHandlersFromAggregateRoot(aggregate);

            handlers.Count().Should().Be(5);
        }
        public void It_should_throw_an_exception_when_mapped_method_does_not_have_a_parameter()
        {
            var aggregate = new NoParameterMethodTarget();
            var mapping = new AttributeBasedDomainSourcedEventHandlerMappingStrategy();

            Action act = () => mapping.GetEventHandlersFromAggregateRoot(aggregate);

            act.ShouldThrow<InvalidEventHandlerMappingException>();
        }
        public void It_should_create_the_correct_event_handlers()
        {
            var aggregate = new GoodTarget();
            var mapping = new AttributeBasedDomainSourcedEventHandlerMappingStrategy();

            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);
            aggregate.CatchAllEventHandlerInvokeCount.Should().Be(4);
        }
        public void It_should_throw_an_exception_when_mapped_method_is_static()
        {
            var aggregate = new IlligalStaticMethodTarget();
            var mapping = new AttributeBasedDomainSourcedEventHandlerMappingStrategy();

            Action act = () => mapping.GetEventHandlersFromAggregateRoot(aggregate);

            act.ShouldThrow<InvalidEventHandlerMappingException>();
        }