Ejemplo n.º 1
0
        public void DomainEventHandlerResolver_GetDomainEventHandlers_EstateCreatedEvent_NoHandlersConfigured_EventHandlersReturned()
        {
            Dictionary <String, String[]> eventHandlerConfiguration = new Dictionary <String, String[]>();

            EstateCreatedEvent         estateCreatedEvent = TestData.EstateCreatedEvent;
            Mock <IDomainEventHandler> domainEventHandler = new Mock <IDomainEventHandler>();

            Func <Type, IDomainEventHandler> createDomainEventHandlerFunc = (type) => { return(domainEventHandler.Object); };

            DomainEventHandlerResolver resolver = new DomainEventHandlerResolver(eventHandlerConfiguration, createDomainEventHandlerFunc);

            List <IDomainEventHandler> handlers = resolver.GetDomainEventHandlers(estateCreatedEvent);

            handlers.ShouldBeNull();
        }
Ejemplo n.º 2
0
        public void DomainEventHandlerResolver_GetDomainEventHandlers_ResponseReceivedFromProviderEvent_NoHandlersConfigured_EventHandlersReturned()
        {
            Dictionary <String, String[]> eventHandlerConfiguration = new Dictionary <String, String[]>();

            ResponseReceivedFromEmailProviderEvent responseReceivedFromProviderEvent = TestData.ResponseReceivedFromEmailProviderEvent;
            Mock <IDomainEventHandler>             domainEventHandler = new Mock <IDomainEventHandler>();

            Func <Type, IDomainEventHandler> createDomainEventHandlerFunc = (type) => { return(domainEventHandler.Object); };

            DomainEventHandlerResolver resolver = new DomainEventHandlerResolver(eventHandlerConfiguration, createDomainEventHandlerFunc);

            List <IDomainEventHandler> handlers = resolver.GetDomainEventHandlers(responseReceivedFromProviderEvent);

            handlers.ShouldBeNull();
        }
Ejemplo n.º 3
0
        public void DomainEventHandlerResolver_GetDomainEventHandlers_EstateCreatedEvent_EventNotConfigured_EventHandlersReturned()
        {
            String handlerTypeName = "EstateReporting.BusinessLogic.EventHandling.EstateDomainEventHandler, EstateReporting.BusinessLogic";
            Dictionary <String, String[]> eventHandlerConfiguration = new Dictionary <String, String[]>();

            EstateCreatedEvent estateCreatedEvent = TestData.EstateCreatedEvent;

            eventHandlerConfiguration.Add("RandomEvent", new String[] { handlerTypeName });
            Mock <IDomainEventHandler>       domainEventHandler           = new Mock <IDomainEventHandler>();
            Func <Type, IDomainEventHandler> createDomainEventHandlerFunc = (type) => { return(domainEventHandler.Object); };

            DomainEventHandlerResolver resolver = new DomainEventHandlerResolver(eventHandlerConfiguration, createDomainEventHandlerFunc);

            List <IDomainEventHandler> handlers = resolver.GetDomainEventHandlers(estateCreatedEvent);

            handlers.ShouldBeNull();
        }
Ejemplo n.º 4
0
        public void DomainEventHandlerResolver_GetDomainEventHandlers_ResponseReceivedFromProviderEvent_EventNotConfigured_EventHandlersReturned()
        {
            String handlerTypeName = "MessagingService.BusinessLogic.EventHandling.EmailDomainEventHandler, MessagingService.BusinessLogic";
            Dictionary <String, String[]> eventHandlerConfiguration = new Dictionary <String, String[]>();

            ResponseReceivedFromEmailProviderEvent responseReceivedFromProviderEvent = TestData.ResponseReceivedFromEmailProviderEvent;

            eventHandlerConfiguration.Add("RandomEvent", new String[] { handlerTypeName });
            Mock <IDomainEventHandler>       domainEventHandler           = new Mock <IDomainEventHandler>();
            Func <Type, IDomainEventHandler> createDomainEventHandlerFunc = (type) => { return(domainEventHandler.Object); };

            DomainEventHandlerResolver resolver = new DomainEventHandlerResolver(eventHandlerConfiguration, createDomainEventHandlerFunc);

            List <IDomainEventHandler> handlers = resolver.GetDomainEventHandlers(responseReceivedFromProviderEvent);

            handlers.ShouldBeNull();
        }
        public void DomainEventHandlerResolver_GetDomainEventHandlers_TransactionHasBeenCompletedEvent_EventHandlersReturned()
        {
            String handlerTypeName = "VoucherManagement.BusinessLogic.EventHandling.VoucherDomainEventHandler, VoucherManagement.BusinessLogic";
            Dictionary <String, String[]> eventHandlerConfiguration = new Dictionary <String, String[]>();

            VoucherIssuedEvent voucherIssuedEvent = TestData.VoucherIssuedEvent;

            eventHandlerConfiguration.Add(voucherIssuedEvent.GetType().Name, new String[] { handlerTypeName });

            Mock <IDomainEventHandler>       domainEventHandler           = new Mock <IDomainEventHandler>();
            Func <Type, IDomainEventHandler> createDomainEventHandlerFunc = (type) => { return(domainEventHandler.Object); };

            DomainEventHandlerResolver resolver = new DomainEventHandlerResolver(eventHandlerConfiguration, createDomainEventHandlerFunc);

            List <IDomainEventHandler> handlers = resolver.GetDomainEventHandlers(voucherIssuedEvent);

            handlers.ShouldNotBeNull();
            handlers.Any().ShouldBeTrue();
            handlers.Count.ShouldBe(1);
        }