public void GetHeaders_Should_Return_Collection_With_MessageId_Header_Configured() { var options = new PublishOptions(); var result = options.GetHeaders(); Assert.AreEqual(1, result.Count); CollectionAssert.Contains(result.Keys, Headers.MessageId); }
public void ShouldSetOptions() { var options = new PublishOptions(); var key = "code"; var value = "abc"; options.SetHeaders(key, value); options.GetHeaders()[key].Should().Be(value); }
public void When_publishing_should_clone_headers() { var publishPipeline = new FakePipeline <IOutgoingPublishContext>(); var messageOperations = CreateMessageOperations(publishPipeline: publishPipeline); var publishOptions = new PublishOptions(); publishOptions.SetHeader("header1", "header1 value"); messageOperations.Publish <MyMessage>(new FakeRootContext(), m => { }, publishOptions); publishPipeline.ReceivedContext.Headers.Add("header2", "header2 value"); publishPipeline.ReceivedContext.Headers["header1"] = "updated header1 value"; var optionsHeaders = publishOptions.GetHeaders(); Assert.AreEqual(1, optionsHeaders.Count); Assert.AreEqual("header1 value", optionsHeaders["header1"]); }