Ejemplo n.º 1
0
        public void EventHandlersForMockHasBeenAddedEventShouldBeResolved()
        {
            //Given
            var notifyFoo     = new NotifyFoo();
            var notifyBar     = new NotifyBar();
            var notifyMockOne = new NotifyMockOne();
            //When
            var eventHandlerFactory = new EventHandlerFactory();

            eventHandlerFactory.Register <MockHasBeenAddedEvent>(notifyBar);
            eventHandlerFactory.Register <MockHasBeenAddedEvent>(notifyFoo);
            eventHandlerFactory.Register <MockHasBeenRemovedEvent>(notifyMockOne);
            //Then
            var listOfEventHandlersForMockHasBeenAddedEvent   = eventHandlerFactory.Resolved <MockHasBeenAddedEvent>();
            var listOfEventHandlersForMockHasBeenRemovedEvent = eventHandlerFactory.Resolved <MockHasBeenRemovedEvent>();

            Assert.IsType <NotifyBar>(listOfEventHandlersForMockHasBeenAddedEvent[0]);
            Assert.IsType <NotifyFoo>(listOfEventHandlersForMockHasBeenAddedEvent[1]);
            Assert.IsType <NotifyMockOne>(listOfEventHandlersForMockHasBeenRemovedEvent[0]);
        }