public void When_sending_with_user_defined_message_id_should_set_defined_id_and_header() { const string expectedMessageID = "expected message id"; var sendPipeline = new FakePipeline <IOutgoingSendContext>(); var context = CreateContext(sendPipeline); var sendOptions = new SendOptions(); sendOptions.SetMessageId(expectedMessageID); MessageOperations.Send <MyMessage>(context, m => { }, sendOptions); Assert.AreEqual(expectedMessageID, sendPipeline.ReceivedContext.MessageId); Assert.AreEqual(expectedMessageID, sendPipeline.ReceivedContext.Headers[Headers.MessageId]); }
public void When_sending_should_clone_headers() { var sendPipeline = new FakePipeline <IOutgoingSendContext>(); var context = CreateContext(sendPipeline); var sendOptions = new SendOptions(); sendOptions.SetHeader("header1", "header1 value"); MessageOperations.Send <MyMessage>(context, m => { }, sendOptions); sendPipeline.ReceivedContext.Headers.Add("header2", "header2 value"); sendPipeline.ReceivedContext.Headers["header1"] = "updated header1 value"; var optionsHeaders = sendOptions.GetHeaders(); Assert.AreEqual(1, optionsHeaders.Count); Assert.AreEqual("header1 value", optionsHeaders["header1"]); }