public void AddNativeHeaderImmutable()
        {
            var headerAccessor = new NativeMessageHeaderAccessor();

            headerAccessor.AddNativeHeader("foo", "bar");
            headerAccessor.SetImmutable();
            var ex = Assert.Throws <InvalidOperationException>(() => headerAccessor.AddNativeHeader("foo", "baz"));

            Assert.Contains("Already immutable", ex.Message);
        }
        public void SetImmutableIdempotent()
        {
            var headerAccessor = new NativeMessageHeaderAccessor();

            headerAccessor.AddNativeHeader("foo", "bar");
            headerAccessor.SetImmutable();
            headerAccessor.SetImmutable();
        }
        public void AddNativeHeaderLazyInitNullValue()
        {
            var headerAccessor = new NativeMessageHeaderAccessor();

            headerAccessor.AddNativeHeader("foo", null);

            Assert.Null(headerAccessor.GetNativeHeader("foo"));
            Assert.Null(headerAccessor.MessageHeaders[NativeMessageHeaderAccessor.NATIVE_HEADERS]);
        }
        public void AddNativeHeaderLazyInit()
        {
            var headerAccessor = new NativeMessageHeaderAccessor();

            headerAccessor.AddNativeHeader("foo", "bar");

            Assert.Equal(new List <string>()
            {
                "bar"
            }, headerAccessor.GetNativeHeader("foo"));
        }
Beispiel #5
0
        public void AddNativeHeaderNullValue()
        {
            var nativeHeaders = new Dictionary <string, List <string> >();

            nativeHeaders.Add("foo", new List <string>()
            {
                "bar"
            });

            var headers = new NativeMessageHeaderAccessor(nativeHeaders);

            headers.AddNativeHeader("foo", null);

            Assert.Equal(new List <string>()
            {
                "bar"
            }, headers.GetNativeHeader("foo"));
        }
        public void AddNativeHeader()
        {
            var nativeHeaders = new Dictionary <string, List <string> >
            {
                { "foo", new List <string>()
                  {
                      "bar"
                  } }
            };

            var headers = new NativeMessageHeaderAccessor(nativeHeaders);

            headers.AddNativeHeader("foo", "baz");

            Assert.Equal(new List <string>()
            {
                "bar", "baz"
            }, headers.GetNativeHeader("foo"));
        }