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 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 ResolveArgumentNativeHeaderAmbiguity() { var headers = new TestMessageHeaderAccessor(); headers.SetHeader("param1", "foo"); headers.SetNativeHeader("param1", "native-foo"); var message = MessageBuilder.WithPayload(new byte[0]).SetHeaders(headers).Build(); Assert.Equal("foo", resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.HeaderPlain()).Arg(), message)); Assert.Equal("native-foo", resolver.ResolveArgument(resolvable.Annot(MessagingPredicates.Header("nativeHeaders.param1")).Arg(), message)); }