public void ResolveArgumentDefaultValue()
        {
            var message = MessageBuilder.WithPayload(new byte[0]).Build();
            var result  = resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.Header("name", "bar")).Arg(), message);

            Assert.Equal("bar", result);
        }
        public void ResolveArgument()
        {
            var message = MessageBuilder.WithPayload(new byte[0]).SetHeader("param1", "foo").Build();
            var result  = resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.HeaderPlain()).Arg(), message);

            Assert.Equal("foo", result);
        }
        public void ResolveOptionalHeaderAsEmpty()
        {
            var message = MessageBuilder.WithPayload("foo").Build();
            var param   = resolvable.Annot(MessagingPredicates.Header("foo")).Arg();
            var result  = resolver.ResolveArgument(param, message);

            Assert.Null(result);
        }
        public void ResolveOptionalHeaderWithValue()
        {
            var message = MessageBuilder.WithPayload("foo").SetHeader("foo", "bar").Build();
            var param   = resolvable.Annot(MessagingPredicates.Header("foo")).Arg();
            var result  = resolver.ResolveArgument(param, message);

            Assert.Equal("bar", result);
        }
        public void ResolveArgumentNativeHeader()
        {
            var headers = new TestMessageHeaderAccessor();

            headers.SetNativeHeader("param1", "foo");
            var message = MessageBuilder.WithPayload(new byte[0]).SetHeaders(headers).Build();

            Assert.Equal("foo", resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.HeaderPlain()).Arg(), message));
        }
        public void ResolveArgument()
        {
            var vars = new Dictionary <string, object>();

            vars.Add("foo", "bar");
            vars.Add("name", "value");

            var message = MessageBuilder <byte[]> .WithPayload(new byte[0]).SetHeader(DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER, vars).Build();

            var param  = resolvable.Annot(MessagingPredicates.DestinationVar().NoName()).Arg();
            var result = resolver.ResolveArgument(param, message);

            Assert.Equal("bar", result);

            param  = resolvable.Annot(MessagingPredicates.DestinationVar("name")).Arg();
            result = resolver.ResolveArgument(param, message);
            Assert.Equal("value", result);
        }
        public void ResolveArgumentNotFound()
        {
            var message = MessageBuilder <byte[]> .WithPayload(new byte[0]).Build();

            Assert.Throws <MessageHandlingException>(() => resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.DestinationVar().NoName()).Arg(), message));
        }
 public void SupportsParameter()
 {
     Assert.True(resolver.SupportsParameter(resolvable.Annot(MessagingPredicates.DestinationVar().NoName()).Arg()));
     Assert.False(resolver.SupportsParameter(resolvable.AnnotNotPresent(typeof(DestinationVariableAttribute)).Arg()));
 }
        public void ResolveArgumentNotFound()
        {
            var message = MessageBuilder.WithPayload(new byte[0]).Build();

            Assert.Throws <MessageHandlingException>(() => resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.HeaderPlain()).Arg(), message));
        }
 public void SupportsParameter()
 {
     Assert.True(resolver.SupportsParameter(resolvable.Annot(MessagingPredicates.HeaderPlain()).Arg()));
     Assert.False(resolver.SupportsParameter(resolvable.AnnotNotPresent(typeof(HeaderAttribute)).Arg()));
 }