public async Task OnMessageReceived_SingleMessage_Relayed()
        {
            var outboundMessage = new OutboundMessage <TestEventOne>(new TestEventOne {
                Content = "Test"
            }, null, TestEndpoint.GetDefault());

            await _connector.RelayMessage(outboundMessage);

            _broker.ProducedMessages.Count.Should().Be(1);
            _broker.ProducedMessages.First().Endpoint.Should().Be(outboundMessage.Endpoint);

            var producedMessage = outboundMessage.Endpoint.Serializer.Deserialize(
                _broker.ProducedMessages.First().Message,
                new MessageHeaderCollection(_broker.ProducedMessages.First().Headers)) as TestEventOne;

            producedMessage.Id.Should().Be(outboundMessage.Content.Id);
        }
Esempio n. 2
0
        public async Task OnMessageReceived_SingleMessage_Relayed()
        {
            var outboundMessage = new OutboundMessage <TestEventOne>()
            {
                Message = new TestEventOne {
                    Content = "Test"
                },
                Endpoint = TestEndpoint.Default
            };

            await _connector.RelayMessage(outboundMessage);

            _broker.ProducedMessages.Count.Should().Be(1);
            _broker.ProducedMessages.First().Endpoint.Should().Be(outboundMessage.Endpoint);

            var producedMessage = outboundMessage.Endpoint.Serializer.Deserialize(_broker.ProducedMessages.First().Message) as TestEventOne;

            producedMessage.Id.Should().Be(outboundMessage.Message.Id);
        }