Пример #1
0
        public void handlers_reply_with_an_object()
        {
            using (MessageId.PauseIdGeneration())
            {
                var command = new FakeCommand(123);
                var commandResult = new FakeCommandResult("CommandResult", 45);
                var transportMessageReceived = command.ToTransportMessage(_peerUp);
                SetupDispatch(command, _ => _bus.Reply(commandResult));

                var expectedExecutionCompleted = MessageExecutionCompleted.Success(transportMessageReceived.Id, commandResult, _messageSerializer);
                var expectedTransportMessage = expectedExecutionCompleted.ToTransportMessage(_self);

                _transport.RaiseMessageReceived(transportMessageReceived);

                var sentMessage = _transport.Messages.Single();
                expectedTransportMessage.ShouldHaveSamePropertiesAs(sentMessage.TransportMessage);
                var destination = sentMessage.Targets.Single();
                destination.ShouldHaveSamePropertiesAs(_peerUp);
            }
        }
Пример #2
0
        public void should_reply_with_response()
        {
            var response = new FakeCommandResult("X", 42);

            _bus.Reply(response);

            _context.ReplyResponse.ShouldEqual(response);
        }