示例#1
0
        public void CopyHeadersFromNullMap()
        {
            var headers = new MessageHeaderAccessor();

            headers.CopyHeaders(null);
            headers.CopyHeadersIfAbsent(null);

            Assert.Equal(1, headers.MessageHeaders.Count);
            Assert.Contains("id", headers.MessageHeaders.Keys);
        }
示例#2
0
        public void CopyHeaders()
        {
            IDictionary <string, object> map1 = new Dictionary <string, object>();

            map1.Add("foo", "bar");
            var message  = new GenericMessage <string>("payload", map1);
            var accessor = new MessageHeaderAccessor(message);

            IDictionary <string, object> map2 = new Dictionary <string, object>();

            map2.Add("foo", "BAR");
            map2.Add("bar", "baz");
            accessor.CopyHeaders(map2);

            var actual = accessor.MessageHeaders;

            Assert.Equal(3, actual.Count);
            Assert.Equal("BAR", actual.Get <string>("foo"));
            Assert.Equal("baz", actual.Get <string>("bar"));
        }
        public void CopyHeaders()
        {
            IDictionary <string, object> map1 = new Dictionary <string, object>
            {
                { "foo", "bar" }
            };
            var message  = Message.Create <string>("payload", map1);
            var accessor = new MessageHeaderAccessor(message);

            IDictionary <string, object> map2 = new Dictionary <string, object>
            {
                { "foo", "BAR" },
                { "bar", "baz" }
            };

            accessor.CopyHeaders(map2);

            var actual = accessor.MessageHeaders;

            Assert.Equal(3, actual.Count);
            Assert.Equal("BAR", actual.Get <string>("foo"));
            Assert.Equal("baz", actual.Get <string>("bar"));
        }