예제 #1
0
        public async Task Should_contain_the_same_payloads()
        {
            EndpointConvention.Map <B>(InputQueueAddress);

            var sendObserver = new TestSendObserver(TimeSpan.FromSeconds(3));

            using (Bus.ConnectSendObserver(sendObserver))
            {
                await InputQueueSendEndpoint.Send(new A());

                ISentMessage <A> a = sendObserver.Messages.Select <A>().FirstOrDefault();
                ISentMessage <B> b = sendObserver.Messages.Select <B>().FirstOrDefault();

                a.ShouldNotBeNull();
                b.ShouldNotBeNull();

                Dictionary <string, object> ah = a.Context.Headers.GetAll().ToDictionary(x => x.Key, x => x.Value);
                Dictionary <string, object> bh = b.Context.Headers.GetAll().ToDictionary(x => x.Key, x => x.Value);

                ah.ShouldContainKey("x-send-filter");
                ah.ShouldContainKey("x-send-message-filter");
                ah["x-send-filter"].ShouldBe("send-filter");
                ah["x-send-message-filter"].ShouldBe("send-message-filter");

                bh.ShouldContainKey("x-send-filter");
                bh.ShouldContainKey("x-send-message-filter");

                // those fails, as while they DO have ",has-consume-context" they don't have access to SomePayload
                bh["x-send-filter"].ShouldBe("send-filter,has-consume-context,has-some-payload:hello");
                bh["x-send-message-filter"].ShouldBe("send-message-filter,has-consume-context,has-some-payload:hello");
            }
        }
        public async Task Should_have_sent_message_to_bus_address()
        {
            ISentMessage <B> message = await _harness.Sent.SelectAsync <B>().First();

            message.ShouldNotBeNull();

            message.Context.DestinationAddress.ShouldBe(_harness.BusAddress);
        }