Example #1
0
 public void Should_send_message_with_handler_id()
 {
     Expect.Call(_responseHandler.HandledMessageType).Return(_handlerId);
     _repository.ReplayAll();
     GetInvocationHelper().Item1.Hello(5);
     _channel.AssertWasCalled(ch => ch.Send(Arg <IMessage> .Matches(m => m.CorrelationId == _handlerId)));
 }
Example #2
0
        public void Should_send_response_for_exception_if_response_is_expected()
        {
            _handler.Stub(h => h.Foo()).Throw(new Exception());

            var correlationId = Guid.NewGuid().ToString();
            var reqest        = new RequestMessage(correlationId, "group", "Foo", new object[0], true)
            {
                Channel = _channel
            };

            _subject.Handle(reqest);
            _channel.AssertWasCalled(ch => ch.Send(Arg <ExceptionResponseMessage> .Matches(r => r.CorrelationId == correlationId)));
        }
        public void Should_send_message_with_method_details()
        {
            Configurator.Configure();
            _repository.ReplayAll();

            const int methodArg = 5;

            GetInvocationHelper().Hello(methodArg);

            _channel.AssertWasCalled(ch => ch.Send(Arg <RequestMessage> .Matches(m =>
                                                                                 m.Args.SequenceEqual(new object[] { methodArg }) &&
                                                                                 m.MethodName == "Hello" &&
                                                                                 m.MessageType == _interfaceName)));
        }