Example #1
0
            public void ShouldThrowWhenNoHandlerIsResolvedFromMultiMessageHandlerResolve()
            {
                // Given empty registration
                MultiMessageHandlerRegistration registration     = CreateMultiHandlerRegistration();
                RequiredMessageHandlerResolver  requiredResolver = CreateRequiredMessageHandlerResolver(registration.BuildMessageHandlerResolver());

                Action action = () =>
                {
                    // When
                    MessageHandlerDelegate handler = requiredResolver.ResolveMessageHandler(typeof(TestMessage));
                };

                // Then
                action.ShouldThrow <NoMessageHandlerResolvedException>("RequiredMessageHandlerResolver should require a message handler to be found.");
            }
Example #2
0
            public void ShouldThrowWhenNoHandlerIsResolvedFromCompositeMessageHandlerResolver()
            {
                // Given empty registration
                IMessageHandlerResolver         multiResolver     = CreateMultiMessageHandlerResolver();
                IMessageHandlerResolver         singleResolver    = CreateSingleMessageHandlerResolver();
                CompositeMessageHandlerResolver compositeResolver = CreateCompositeMessageHandlerResolver(singleResolver, multiResolver);
                RequiredMessageHandlerResolver  requiredResolver  = CreateRequiredMessageHandlerResolver(compositeResolver);

                Action action = () =>
                {
                    // When
                    MessageHandlerDelegate handler = requiredResolver.ResolveMessageHandler(typeof(TestMessage));
                };

                // Then
                action.ShouldThrow <NoMessageHandlerResolvedException>("RequiredMessageHandlerResolver should require a message handler to be found.");
            }