public void TestPopSequenceDetailsWhenNotPoppedMutable()
        {
            var message1 = MutableIntegrationMessageBuilder <int> .WithPayload(1).Build();

            Assert.False(message1.Headers.ContainsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
            var message2 = MutableIntegrationMessageBuilder <int> .FromMessage(message1).PopSequenceDetails().Build();

            Assert.False(message2.Headers.ContainsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
        }
        public void MutableFromImmutable()
        {
            var message1 = IntegrationMessageBuilder <string> .WithPayload("test").SetHeader("foo", "bar").Build();

            var message2 = MutableIntegrationMessageBuilder <string> .FromMessage(message1).SetHeader("another", 1).Build();

            Assert.Equal("bar", message2.Headers["foo"]);
            Assert.Equal(message1.Headers.Id, message2.Headers.Id);
            Assert.NotEqual(message1, message2);
            Assert.False(message2 == message1);
        }
        public void TestPushAndPopSequenceDetailsWhenNoSequenceMutable()
        {
            var message1 = MutableIntegrationMessageBuilder <int> .WithPayload(1).SetCorrelationId("foo").Build();

            Assert.False(message1.Headers.ContainsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
            var message2 = MutableIntegrationMessageBuilder <int> .FromMessage(message1).PushSequenceDetails("bar", 1, 1).Build();

            Assert.True(message2.Headers.ContainsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
            var message3 = MutableIntegrationMessageBuilder <int> .FromMessage(message2).PopSequenceDetails().Build();

            Assert.False(message3.Headers.ContainsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
        }