public void Create_Default() { var id = Substitute.For<IMessage>(); var message = new AdditionalMessageData(); var test = new SendMessageCommand(id, message); Assert.Equal(id, test.MessageToSend); Assert.Equal(message, test.MessageData); }
public static TimeSpan GetExpiration(SendMessageCommand commandSend, IHeaders headers) { //there are three possible locations for a message expiration. The user data and the header / internal headers //grab it from the internal header var expiration = commandSend.MessageToSend.GetInternalHeader(headers.StandardHeaders.RpcTimeout).Timeout; //if the header value is zero, check the message expiration if (expiration == TimeSpan.Zero) { //try the message header expiration = commandSend.MessageToSend.GetHeader(headers.StandardHeaders.RpcTimeout).Timeout; } //if the header value is zero, check the message expiration if (expiration == TimeSpan.Zero && commandSend.MessageData.GetExpiration().HasValue) { // ReSharper disable once PossibleInvalidOperationException expiration = commandSend.MessageData.GetExpiration().Value; } return expiration; }