public void RequestInfoShouldCreateTunneledDeleteRequestMessageDeleteMethodAndDeleteInHttpXMethodHeader(HttpRequestTransportMode requestTransportMode)
        {
            bool previousPostTunnelingValue = ctx.UsePostTunneling;

            ctx.UsePostTunneling         = true;
            ctx.HttpRequestTransportMode = requestTransportMode;
            HeaderCollection headersCollection = new HeaderCollection();
            var descriptor = new EntityDescriptor(this.clientEdmModel)
            {
                ServerTypeName = this.serverTypeName, Entity = new Customer()
            };
            var buildingRequestArgs = new BuildingRequestEventArgs("DELETE", new Uri("http://localhost/fakeService.svc/"), headersCollection, descriptor, HttpStack.Auto);

            var requestMessage = testSubject.CreateRequestMessage(buildingRequestArgs);

            requestMessage.GetHeader(XmlConstants.HttpXMethod).Should().Be("DELETE");
            requestMessage.GetHeader(XmlConstants.HttpContentLength).Should().Be("0");
            requestMessage.GetHeader(XmlConstants.HttpContentType).Should().BeEmpty();
            requestMessage.Method.Should().Be("DELETE");

            if (requestTransportMode == HttpRequestTransportMode.HttpClient)
            {
                ((HttpClientRequestMessage)requestMessage).HttpRequestMessage.Method.Should().Be(HttpMethod.Post);
            }
            else
            {
                ((HttpWebRequestMessage)requestMessage).HttpWebRequest.Method.Should().Be("POST");
            }

            // undoing change so this is applicable only for this test.
            ctx.UsePostTunneling = previousPostTunnelingValue;
        }
        /// <summary>
        /// Create a request message for a non-batch requests and outer $batch request. This method copies request headers
        /// from <paramref name="requestMessageArgs"/> in addition to the method and Uri.
        /// </summary>
        /// <param name="requestMessageArgs">RequestMessageArgs for the request.</param>
        /// <param name="requestInfo">RequestInfo instance.</param>
        /// <returns>an instance of ODataRequestMessageWrapper.</returns>
        internal static ODataRequestMessageWrapper CreateRequestMessageWrapper(BuildingRequestEventArgs requestMessageArgs, RequestInfo requestInfo)
        {
            Debug.Assert(requestMessageArgs != null, "requestMessageArgs != null");

            var requestMessage = requestInfo.CreateRequestMessage(requestMessageArgs);

            if (requestInfo.Credentials != null)
            {
                requestMessage.Credentials = requestInfo.Credentials;
            }

            if (requestInfo.Timeout != 0)
            {
                requestMessage.Timeout = requestInfo.Timeout;
            }

            if (requestInfo.ReadWriteTimeout != 0)
            {
                requestMessage.ReadWriteTimeout = requestInfo.ReadWriteTimeout;
            }

            return(new TopLevelRequestMessageWrapper(requestMessage, requestInfo, requestMessageArgs.Descriptor));
        }