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()); }
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()); }