Ejemplo n.º 1
0
        public void TestRemoveHeaderEvenIfNull()
        {
            IMessage <string> message = new GenericMessage <string>("payload", SingletonMap("foo", null));
            var accessor = new MessageHeaderAccessor(message);

            accessor.RemoveHeader("foo");
            var headers = accessor.ToDictionary();

            Assert.False(headers.ContainsKey("foo"));
        }
        public void TestRemoveHeader()
        {
            IMessage message  = Message.Create <string>("payload", SingletonMap("foo", "bar"));
            var      accessor = new MessageHeaderAccessor(message);

            accessor.RemoveHeader("foo");
            var headers = accessor.ToDictionary();

            Assert.False(headers.ContainsKey("foo"));
        }
Ejemplo n.º 3
0
        public void ToDictionary()
        {
            var accessor = new MessageHeaderAccessor();

            accessor.SetHeader("foo", "bar1");
            var map1 = accessor.ToDictionary();

            accessor.SetHeader("foo", "bar2");
            var map2 = accessor.ToDictionary();

            accessor.SetHeader("foo", "bar3");
            var map3 = accessor.ToDictionary();

            Assert.Equal(1, map1.Count);
            Assert.Equal(1, map2.Count);
            Assert.Equal(1, map3.Count);

            Assert.Equal("bar1", map1["foo"]);
            Assert.Equal("bar2", map2["foo"]);
            Assert.Equal("bar3", map3["foo"]);
        }
Ejemplo n.º 4
0
        public void NewEmptyHeaders()
        {
            var accessor = new MessageHeaderAccessor();

            Assert.Equal(0, accessor.ToDictionary().Count);
        }