public static bool HasValue(this ExtendableOptions options)
    {
        var messageId = options.GetMessageId();

        if (messageId is not null)
        {
            return(true);
        }

        if (options is SendOptions sendOptions)
        {
            if (sendOptions.GetDeliveryDate().HasValue || sendOptions.GetDeliveryDelay().HasValue)
            {
                return(true);
            }
        }

        var headers = options.GetHeaders();

        if (headers.Any())
        {
            return(true);
        }

        var extensions = options.GetExtensions();

        if (extensions is not null)
        {
            return(ContextBagHelper.HasContent(extensions));
        }

        return(false);
    }
        public void ShouldApplyMessageId(ExtendableOptions options)
        {
            var messageId = Guid.NewGuid().ToString();

            MessageId.Set(messageId).Apply(options);

            Assert.AreEqual(options.GetMessageId(), messageId);
            Assert.IsTrue(MessageId.Set(messageId).IsApplied(options));
        }
Ejemplo n.º 3
0
 internal override bool IsApplied(ExtendableOptions options)
 {
     return(options.GetMessageId() == messageId);
 }