public void BeforeSendRequestTest()
        {
            // Arrange.
            const string HeaderName1 = "Header1";
            const string HeaderName2 = "Header2";
            const string HeaderNamespace = "TestNamespace";
            const string Actor = "TestActor";

            var oldHeader1 = MessageHeader.CreateHeader(HeaderName1, HeaderNamespace, "Test Value 1");
            var oldHeader2 = MessageHeader.CreateHeader(HeaderName2, HeaderNamespace, "Test Value 2");

            var operationContext = Mock.Create<OperationContext>();
            Mock.Arrange(() => OperationContext.Current).Returns(operationContext);

            var headerAttributes = new SoapHeaderAttributes
                                       {
                                           HeaderName = HeaderName2,
                                           HeaderNamespace = HeaderNamespace,
                                           MustUnderstand = true,
                                           Actor = Actor,
                                           Relay = true
                                       };

            var integrationExtension = new IntegrationServiceOperationContextExtension();
            integrationExtension.HeaderAttributes.Add(headerAttributes);

            var extensions = new ExtensionCollection<OperationContext>(operationContext) { integrationExtension };
            Mock.Arrange(() => operationContext.Extensions).Returns(extensions);

            var message = Mock.Create<Message>();
            var messageHeaders = new MessageHeaders(MessageVersion.Soap11) { oldHeader1, oldHeader2 };
            Mock.Arrange(() => message.Headers).Returns(messageHeaders);

            var inspector = new IntegrationServiceMessageInspector();
            
            // Act.
            var newMessage = message;
            inspector.BeforeSendRequest(ref newMessage, Mock.Create<IClientChannel>());

            // Assert.
            Assert.AreSame(message, newMessage);

            Assert.AreEqual(2, messageHeaders.Count);
            Assert.IsTrue(messageHeaders.Contains(oldHeader1));
            Assert.IsFalse(messageHeaders.Contains(oldHeader2));

            var index = messageHeaders.FindHeader(HeaderName2, HeaderNamespace, Actor);
            var newHeader2 = (XmlElementMessageHeader)messageHeaders[index];

            Assert.IsTrue(newHeader2.MustUnderstand);
            Assert.AreEqual(Actor, newHeader2.Actor);
            Assert.IsTrue(newHeader2.Relay);

            // Exceptions.
            Message nullMessage = null;

            TestsHelper.VerifyThrow<ArgumentNullException>(() => inspector.BeforeSendRequest(ref nullMessage, Mock.Create<IClientChannel>()));

            var message2 = Mock.Create<Message>();
            TestsHelper.VerifyThrow<ArgumentNullException>(() => inspector.BeforeSendRequest(ref message2, null));
        }