예제 #1
0
        public void throws_exception_when_handler_does_NOT_implement_expected_interface()
        {
            var invalidHandlerInstanceType = typeof(object);
            var builder = new MessageRegistrationBuilder().WithHandlerInstanceType(invalidHandlerInstanceType);

            Assert.Throws <MessageRegistrationException>(() => builder.Build());
        }
예제 #2
0
        public void throws_exception_when_handler_closes_different_message_type_than_what_its_registered_with()
        {
            var handlerInstanceTypeStub = typeof(IMessageHandler <object>);
            var messageInstanceTypeStub = typeof(FooMessage);

            var builder = new MessageRegistrationBuilder()
                          .WithHandlerInstanceType(handlerInstanceTypeStub)
                          .WithMessageInstanceType(messageInstanceTypeStub);

            Assert.Throws <MessageRegistrationException>(() => builder.Build());
        }