The class is used as the return type for Adapter methods, it contains all data in the HTTP response by parsing the "HttpWebResponse" object, and the data are returned and used by the test cases.
        /// <summary>
        /// The method is used to send a HTTP request using PROPFIND method to the protocol server.
        /// As a result, it will return the "HttpWebResponse" object received from the protocol server.
        /// </summary>
        /// <param name="requestUri">The resource Request_URI for the HTTP request.</param>
        /// <param name="body">The body content in the HTTP request.</param>
        /// <param name="headersCollection">The collections for Name/Value pair of headers that would be inserted in the header of the HTTP request.</param>
        /// <returns>The "WDVMODUUResponse" Object that reserved data from the protocol server for the HTTP request.</returns>
        public WDVMODUUResponse PropFind(string requestUri, string body, NameValueCollection headersCollection)
        {
            // Construct an "HttpWebRequest" object based on the input request URI.
            HttpWebRequest httpWebRequest = this.ConstructHttpWebRequest(requestUri);

            // Specify the method in the HTTP request.
            httpWebRequest.Method = "PROPFIND";

            // Set the HTTP headers in the HTTP request from inputs.
            foreach (string name in headersCollection.AllKeys)
            {
                if (name.Equals("User-Agent"))
                {
                    httpWebRequest.UserAgent = headersCollection[name];
                }
                else if (name.Equals("ContentType"))
                {
                    httpWebRequest.ContentType = headersCollection[name];
                }
                else
                {
                    httpWebRequest.Headers.Set(name, headersCollection[name]);
                }
            }

            // Encode the body using UTF-8.
            byte[] bytes = Encoding.UTF8.GetBytes((string)body);

            // Set the HTTP header of content length.
            httpWebRequest.ContentLength = bytes.Length;

            // Get a reference to the request stream.
            Stream requestStream = httpWebRequest.GetRequestStream();

            // Write the request body to the request stream.
            requestStream.Write(bytes, 0, bytes.Length);

            // Close the Stream object to release the connection for further use.
            requestStream.Close();

            // Reserve the last HTTP Request Data.
            this.ReserveRequestData(httpWebRequest, body);

            // Send the PROPFIND method request and get the response from the protocol server.
            HttpWebResponse httpWebResponse = this.GetResponse(httpWebRequest);

            this.Site.Assert.IsNotNull(httpWebResponse, "The 'HttpWebResponse' object should not be null!");

            // Reserve the last HTTP Response Data.
            WDVMODUUResponse responseWDVMODUU = new WDVMODUUResponse();

            this.lastRawResponse = responseWDVMODUU.ReserveResponseData(httpWebResponse, this.Site);
            this.AssertWDVMODUUResponse(responseWDVMODUU);

            // Return the "WDVMODUUResponse" Object.
            return(responseWDVMODUU);
        }
        /// <summary>
        /// The method is used to send a HTTP request using DELETE method to the protocol server.
        /// As a result, it will return the "HttpWebResponse" object received from the protocol server.
        /// </summary>
        /// <param name="requestUri">The resource Request_URI for the HTTP request.</param>
        /// <param name="headersCollection">The collections for Name/Value pair of headers that would be inserted in the header of the HTTP request.</param>
        /// <returns>The "WDVMODUUResponse" Object that reserved data from the protocol server for the HTTP request.</returns>
        public WDVMODUUResponse Delete(string requestUri, NameValueCollection headersCollection)
        {
            // Construct an "HttpWebRequest" object based on the input request URI.
            HttpWebRequest httpWebRequest = this.ConstructHttpWebRequest(requestUri);

            // Specify the method in the HTTP request.
            httpWebRequest.Method = "DELETE";

            // Set the HTTP headers in the HTTP request from inputs.
            foreach (string name in headersCollection.AllKeys)
            {
                if (name.Equals("User-Agent"))
                {
                    httpWebRequest.UserAgent = headersCollection[name];
                }
                else if (name.Equals("ContentType"))
                {
                    httpWebRequest.ContentType = headersCollection[name];
                }
                else
                {
                    httpWebRequest.Headers.Set(name, headersCollection[name]);
                }
            }

            // Reserve the last HTTP Request Data.
            this.ReserveRequestData(httpWebRequest, null);

            // Send the DELETE method request and get the response from the protocol server.
            HttpWebResponse httpWebResponse = this.GetResponse(httpWebRequest);

            this.Site.Assert.IsNotNull(httpWebResponse, "The 'HttpWebResponse' object should not be null!");

            // Reserve the last HTTP Response Data.
            WDVMODUUResponse responseWDVMODUU = new WDVMODUUResponse();

            this.lastRawResponse = responseWDVMODUU.ReserveResponseData(httpWebResponse, this.Site);
            this.AssertWDVMODUUResponse(responseWDVMODUU);

            // Return the "WDVMODUUResponse" Object.
            return(responseWDVMODUU);
        }
        /// <summary>
        /// Get the HTTP response via sending the HTTP request in input parameter "httpRequest".
        /// </summary>
        /// <param name="httpRequest">The HTTP request that will send to the protocol server.</param>
        /// <returns>The HTTP response that received from the protocol server.</returns>
        private HttpWebResponse GetResponse(HttpWebRequest httpRequest)
        {
            HttpWebResponse httpWebResponse = null;

            try
            {
                httpWebResponse = (HttpWebResponse)httpRequest.GetResponse();
            }
            catch (WebException webExceptiion)
            {
                this.Site.Log.Add(LogEntryKind.Comment, "Test Comment: Get following web exception from the server: \r\n{0}", webExceptiion.Message);
                httpWebResponse = (HttpWebResponse)webExceptiion.Response;
                WDVMODUUResponse response = new WDVMODUUResponse();
                this.lastRawResponse = response.ReserveResponseData(httpWebResponse, this.Site);

                // Throw the web exception to test cases.
                throw webExceptiion;
            }

            this.ValidateAndCaptureTransport(httpWebResponse);
            return(httpWebResponse);
        }
        /// <summary>
        /// Delete the file in the internal array list "arrayListOfDeleteFile" from the server.
        /// </summary>
        /// <param name="destinationUri">The file URI that will be deleted from the server.</param>
        /// <returns>Return true if delete the file successfully, else return false.</returns>
        protected bool DeleteTheFileInTheServer(string destinationUri)
        {
            if (string.IsNullOrEmpty(destinationUri))
            {
                return(false);
            }

            bool isSuccessful = false;

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();

            headersCollection.Clear();
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");

            // Send HTTP DELETE method to delete the file.
            WDVMODUUResponse response = this.Adapter.Delete(destinationUri, headersCollection);

            // Assert the DELETE method is successful.
            if (response.StatusCode == HttpStatusCode.NoContent)
            {
                isSuccessful = true;
            }
            else
            {
                isSuccessful = false;
                string errorInfo = string.Format(
                    "Fail to delete file {0} in the server! The return status code is '{1}', and the return status description is '{2}'.",
                    destinationUri,
                    (int)response.StatusCode,
                    response.StatusDescription);
                this.Site.Assert.Fail(errorInfo);
            }

            return(isSuccessful);
        }
 /// <summary>
 /// Assert the return object 'WDVMODUUResponse' is not null, make sure all necessary members in the object are not null.
 /// </summary>
 /// <param name="responseWDVMODUU">The return object 'WDVMODUUResponse' that will be checked.</param>
 private void AssertWDVMODUUResponse(WDVMODUUResponse responseWDVMODUU)
 {
     this.Site.Assert.IsNotNull(responseWDVMODUU, "The response object 'responseWDVMODUU' should not be null!");
     this.Site.Assert.IsNotNull(responseWDVMODUU.HttpHeaders, "The response object 'responseWDVMODUU.HttpHeaders' should not be null!");
     this.Site.Assert.IsNotNull(responseWDVMODUU.ProtocolVersion, "The response object 'responseWDVMODUU.ProtocolVersion' should not be null!");
 }
        /// <summary>
        /// Get the HTTP response via sending the HTTP request in input parameter "httpRequest".
        /// </summary>
        /// <param name="httpRequest">The HTTP request that will send to the protocol server.</param>
        /// <returns>The HTTP response that received from the protocol server.</returns>
        private HttpWebResponse GetResponse(HttpWebRequest httpRequest)
        {
            HttpWebResponse httpWebResponse = null;
            try
            {
                httpWebResponse = (HttpWebResponse)httpRequest.GetResponse();
            }
            catch (WebException webExceptiion)
            {
                this.Site.Log.Add(LogEntryKind.Comment, "Test Comment: Get following web exception from the server: \r\n{0}", webExceptiion.Message);
                httpWebResponse = (HttpWebResponse)webExceptiion.Response;
                WDVMODUUResponse response = new WDVMODUUResponse();
                this.lastRawResponse = response.ReserveResponseData(httpWebResponse, this.Site);

                // Throw the web exception to test cases.
                throw webExceptiion;
            }

            this.ValidateAndCaptureTransport(httpWebResponse);
            return httpWebResponse;
        }
        /// <summary>
        /// The method is used to send a HTTP request using DELETE method to the protocol server.
        /// As a result, it will return the "HttpWebResponse" object received from the protocol server.
        /// </summary>
        /// <param name="requestUri">The resource Request_URI for the HTTP request.</param>
        /// <param name="headersCollection">The collections for Name/Value pair of headers that would be inserted in the header of the HTTP request.</param>
        /// <returns>The "WDVMODUUResponse" Object that reserved data from the protocol server for the HTTP request.</returns>
        public WDVMODUUResponse Delete(string requestUri, NameValueCollection headersCollection)
        {
            // Construct an "HttpWebRequest" object based on the input request URI.
            HttpWebRequest httpWebRequest = this.ConstructHttpWebRequest(requestUri);

            // Specify the method in the HTTP request.
            httpWebRequest.Method = "DELETE";

            // Set the HTTP headers in the HTTP request from inputs.
            foreach (string name in headersCollection.AllKeys)
            {
                if (name.Equals("User-Agent"))
                {
                    httpWebRequest.UserAgent = headersCollection[name];
                }
                else if (name.Equals("ContentType"))
                {
                    httpWebRequest.ContentType = headersCollection[name];
                }
                else
                {
                    httpWebRequest.Headers.Set(name, headersCollection[name]);
                }
            }

            // Reserve the last HTTP Request Data.
            this.ReserveRequestData(httpWebRequest, null);

            // Send the DELETE method request and get the response from the protocol server.
            HttpWebResponse httpWebResponse = this.GetResponse(httpWebRequest);
            this.Site.Assert.IsNotNull(httpWebResponse, "The 'HttpWebResponse' object should not be null!");

            // Reserve the last HTTP Response Data.
            WDVMODUUResponse responseWDVMODUU = new WDVMODUUResponse();
            this.lastRawResponse = responseWDVMODUU.ReserveResponseData(httpWebResponse, this.Site);
            this.AssertWDVMODUUResponse(responseWDVMODUU);

            // Return the "WDVMODUUResponse" Object.
            return responseWDVMODUU;
        }
        /// <summary>
        /// The method is used to send a HTTP request using PUT method to the protocol server.
        /// As a result, it will return the "HttpWebResponse" object received from the protocol server.
        /// </summary>
        /// <param name="requestUri">The resource Request_URI for the HTTP request.</param>
        /// <param name="body">The body content in the HTTP request.</param>
        /// <param name="headersCollection">The collections for Name/Value pair of headers that would be inserted in the header of the HTTP request.</param>
        /// <returns>The "WDVMODUUResponse" Object that reserved data from the protocol server for the HTTP request.</returns>
        public WDVMODUUResponse Put(string requestUri, byte[] body, NameValueCollection headersCollection)
        {
            // Construct an "HttpWebRequest" object based on the input request URI.
            HttpWebRequest httpWebRequest = this.ConstructHttpWebRequest(requestUri);

            // Specify the method in the HTTP request.
            httpWebRequest.Method = "PUT";

            // Set the HTTP headers in the HTTP request from inputs.
            foreach (string name in headersCollection.AllKeys)
            {
                if (name.Equals("User-Agent"))
                {
                    httpWebRequest.UserAgent = headersCollection[name];
                }
                else if (name.Equals("ContentType"))
                {
                    httpWebRequest.ContentType = headersCollection[name];
                }
                else
                {
                    httpWebRequest.Headers.Set(name, headersCollection[name]);
                }
            }

            // Set the content header length. 
            httpWebRequest.ContentLength = body.Length;

            // Get a reference to the request stream.
            Stream requestStream = httpWebRequest.GetRequestStream();

            // Write the request body to the request stream.
            requestStream.Write(body, 0, body.Length);

            // Close the Stream object to release the connection.
            requestStream.Close();

            // Reserve the last HTTP Request Data.
            this.ReserveRequestData(httpWebRequest, Encoding.UTF8.GetString(body));

            // Send the PUT method request and get the response from the protocol server.
            HttpWebResponse httpWebResponse = this.GetResponse(httpWebRequest);
            this.Site.Assert.IsNotNull(httpWebResponse, "The 'HttpWebResponse' object should not be null!");

            // Reserve the last HTTP Response Data.
            WDVMODUUResponse responseWDVMODUU = new WDVMODUUResponse();
            this.lastRawResponse = responseWDVMODUU.ReserveResponseData(httpWebResponse, this.Site);
            this.AssertWDVMODUUResponse(responseWDVMODUU);

            // Return the "WDVMODUUResponse" Object.
            return responseWDVMODUU;
        }
        public void MSWDVMODUU_S04_TC01_MSBinDiffHeader_Put()
        {
            // Get the request URI from the property "Server_TestTxtFileUri_Put".
            string requestUri = Common.GetConfigurationPropertyValue("Server_TestTxtFileUri_Put", this.Site);

            // Get file name from the property "Client_TestTxtFileName", and read its content into byte array.
            byte[] bytesTxtFile = GetLocalFileContent(Common.GetConfigurationPropertyValue("Client_TestTxtFileName", this.Site));

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();
            headersCollection.Add("MS-BinDiff", "1.0");
            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");


            // Call HTTP PUT method to upload the file to the server.
            WDVMODUUResponse response = null;
            HttpWebResponse httpWebResponse = null;

            try
            {
                response = this.Adapter.Put(requestUri, bytesTxtFile, headersCollection);
                this.ArrayListForDeleteFile.Add(requestUri);
                this.Site.Assert.Fail("Failed: The file should not be put successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.UnsupportedMediaType)
                {
                    // The expected web exception is "Unsupported Media Type", if the caught web exception is not "Unsupported Media Type", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S04_TC01_MSBinDiffHeader_Put', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "415 UNSUPPORTED MEDIA TYPE", and then capture MS-WDVMODUU_R901.
            bool isResponseStatusCode415UNSUPPORTEDMEDIATYPE = false;
            if ((response.StatusCode == HttpStatusCode.UnsupportedMediaType)
                && (string.Compare(response.StatusDescription, "UNSUPPORTED MEDIA TYPE", true) == 0))
            {
                isResponseStatusCode415UNSUPPORTEDMEDIATYPE = true;
            }

            if (isResponseStatusCode415UNSUPPORTEDMEDIATYPE == false)
            {
                // Log some information to help users to know why the response does not include "415 UNSUPPORTED MEDIA TYPE". 
                string helpDebugInformation = @"The status code in the HTTP response is not ""415 UNSUPPORTED MEDIA TYPE""\r\n ";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode415UNSUPPORTEDMEDIATYPE,
                901,
                @"[In MS-BinDiff Header] If the MS-BinDiff header is included in an HTTP PUT request, the server MUST fail the request and response with a message containing HTTP status code ""415 UNSUPPORTED MEDIA TYPE"".");

            #endregion
        }
示例#10
0
        public void MSWDVMODUU_S01_TC02_XVirusInfectedHeader_Put()
        {
            // Prerequisites for this test case:
            //     The server has installed valid virus scanner software.
            //     And in the client test environment, under the local output path there is a fake virus file that can be detected by the valid virus scanner software.
            //     The fake virus file name should be set as the value of property "Client_FakeVirusInfectedFileName" in PTF configuration file.

            // Get the URI of the fake virus file from the property "Server_FakeVirusInfectedFileUri_Put",
            // the URI will be used as Request-URI in the HTTP PUT method.
            string requestUri = Common.GetConfigurationPropertyValue("Server_FakeVirusInfectedFileUri_Put", this.Site);

            // The fake virus file is under the local output path, and its name is the value of property "Client_FakeVirusInfectedFileName" in PTF configuration file.
            string fakeVirusInfectedFileName = Common.GetConfigurationPropertyValue("Client_FakeVirusInfectedFileName", this.Site);

            // Assert the fake virus infected file is existed in the local folder.
            if (File.Exists(fakeVirusInfectedFileName) == false)
            {
                this.Site.Assert.Fail("The file '{0}' was not found in local output path(such as: <Solution Directory>\\TestSuite\\Resources\\), prepare a fake virus infected file under the local output path, and make sure the name of the file is same as the value of PTF property \"Client_FakeVirusInfectedFileName\".", fakeVirusInfectedFileName);
            }

            // Read the contents of fake virus file in the client.
            byte[] bytes = GetLocalFileContent(fakeVirusInfectedFileName);

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();

            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");

            // Call HTTP PUT method to upload the fake virus file to the server.
            WDVMODUUResponse response        = null;
            HttpWebResponse  httpWebResponse = null;

            try
            {
                response = this.Adapter.Put(requestUri, bytes, headersCollection);
                this.ArrayListForDeleteFile.Add(requestUri);
                this.Site.Assert.Fail("Failed: The virus file should not be put successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.Conflict)
                {
                    // The expected web exception is "Conflict", if the caught web exception is not "Conflict", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Put', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "409 CONFLICT", and then capture MS-WDVMODUU_R76.
            bool isResponseStatusCode409CONFLICT = false;
            if ((response.StatusCode == HttpStatusCode.Conflict) &&
                (string.Compare(response.StatusDescription, "CONFLICT", true) == 0))
            {
                isResponseStatusCode409CONFLICT = true;
            }

            if (isResponseStatusCode409CONFLICT == false)
            {
                // Log some information to help users to know why the response does not include "409 CONFLICT".
                string helpDebugInformation = @"The status code in the HTTP response is not ""409 CONFLICT"", make sure following conditions are matched, and see more help information under section 1.2.1 in the test suite specification: \r\n ";
                helpDebugInformation += @"1. A valid virus scanner software has been installed in the protocol server, and virus scanner software must be active when a document is uploaded to the protocol server. \r\n";
                helpDebugInformation += @"2. The fake virus infected file " + fakeVirusInfectedFileName + " can be detected by the valid virus scanner software in the protocol server. \r\n";
                helpDebugInformation += @"3. The URI in the PTF property ""Server_FakeVirusInfectedFileUri_Put"" is an addressable path in the protocol server that the test case has permission to upload a file.";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT,
                76,
                @"[In X-Virus-Infected Header] If this [X-Virus-Infected ] header is returned by a WebDAV server in response to an HTTP PUT[ or a GET] request, the server MUST fail the request and respond with a message containing HTTP status code ""409 CONFLICT"".");

            // Confirm the server returns the X-Virus-Infected header in the response, and then capture MS-WDVMODUU_R75.
            bool isXVirusInfectedHeaderReturned = false;
            foreach (string headerName in response.HttpHeaders.AllKeys)
            {
                if (string.Compare(headerName, "X-Virus-Infected", true) == 0)
                {
                    isXVirusInfectedHeaderReturned = true;
                    break;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned,
                75,
                @"[In X-Virus-Infected Header] A WebDAV server returns the X-Virus-Infected header in response to an HTTP [GET or a ]PUT request to indicate that the requested file is infected with a virus.");

            // Get the X-Virus-Infected header and its value into a string.
            string[] headerAndValues             = response.HttpHeaders.ToString().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string   virusInfectedHeaderAndValue = string.Empty;
            foreach (string headerAndValue in headerAndValues)
            {
                if (headerAndValue.ToLower().IndexOf("x-virus-infected") == 0)
                {
                    virusInfectedHeaderAndValue = headerAndValue;
                    break;
                }
            }

            this.Site.Assert.IsTrue(virusInfectedHeaderAndValue != string.Empty, "The X-Virus-Infected header and its value should not be empty string!");

            // Define a regular expression pattern for the syntax: "x-virus-infected" ":" Virus-Name Virus-Name = 1*TEXT
            // "x-virus-infected" is matching for the header name: "x-virus-infected"
            // ":" is matching the colon which must exist.
            // "\s*" is matching the leading white spaces
            // ".*" is matching the name characters other than \r\n
            string virusHeaderPattern = string.Format(@"^x-virus-infected:\s*.*");

            // Check the format of X-Virus-Infected header and its value in the response.
            Site.Log.Add(TestTools.LogEntryKind.Comment, "The X-Virus-Infected header and its value is {0}", virusInfectedHeaderAndValue);
            bool isRightXVirusHeader = Regex.IsMatch(virusInfectedHeaderAndValue, virusHeaderPattern, RegexOptions.IgnoreCase);
            Site.Assert.IsTrue(isRightXVirusHeader, "The format of X-Virus-Infected header should be correct.");

            // Capture MS-WDVMODUU_R7, MS-WDVMODUU_R4, and MS-WDVMODUU_R5, if the format of X-Virus-Infected header and its value is correct.
            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                4,
                @"[In MODUU Extension Headers] The extension headers in this protocol conform to the form and behavior of other custom HTTP 1.1 headers, as specified in [RFC2616] section 4.2.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                5,
                @"[In MODUU Extension Headers] They [The extension headers] are consistent with the WebDAV verbs and headers, as specified in [RFC2518] sections 8 and 9.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                7,
                @"[In X-Virus-Infected Header] If returned, the X-Virus-Infected header MUST take the following form:
X-Virus-Infected Header = ""x-virus-infected"" "":"" Virus-Name
Virus-Name = 1*TEXT");

            #endregion
        }
        /// <summary>
        /// The method "CompareHttpResponses_Put" will call HTTP PUT method and DELETE method twice, PUT method will upload a test file to the server,
        /// and the DELETE method will remove the test file from the server.
        /// In the first time the HTTP PUT and DELETE requests do NOT include the ignored header, and in the second time the HTTP PUT and DELETE requests include the ignored header.
        /// And then the help method compare the key data in the HTTP responses, if they are same then the help method return true, else return false.
        /// </summary>
        /// <param name="requestUri">The request URI that is used in HTTP PUT and DELETE method</param>
        /// <param name="bytesTxtFile">The file content that will be used in HTTP body</param>
        /// <param name="ignoredHttpHeaderName">The ignored header name.</param>
        /// <param name="ignoredHttpHeaderValue">The ignored header value.</param>
        /// <returns>Return true if the key data are same by comparing the responses, else return false.</returns>
        private bool CompareHttpResponses_Put(string requestUri, byte[] bytesTxtFile, string ignoredHttpHeaderName, string ignoredHttpHeaderValue)
        {
            this.Site.Assert.IsNotNull(ignoredHttpHeaderName, "In CompareHttpResponses_Put method, the ignored header name should not be null!");
            this.Site.Assert.IsNotNull(ignoredHttpHeaderValue, "In CompareHttpResponses_Put method, the ignored header value should not be null!");
            this.Site.Assert.IsTrue(ignoredHttpHeaderName != string.Empty, "In CompareHttpResponses_Put method, the ignored header name should not be empty string!");
            this.Site.Assert.IsTrue(ignoredHttpHeaderValue != string.Empty, "In CompareHttpResponses_Put method, the ignored header value should not be empty string!");

            WDVMODUUResponse responseForPutRequestWithIgnoredHeader    = null;
            WDVMODUUResponse responseForPutRequestWithoutIgnoredHeader = null;

            WDVMODUUResponse responseForDeleteRequestWithIgnoredHeader    = null;
            WDVMODUUResponse responseForDeleteRequestWithoutIgnoredHeader = null;

            NameValueCollection headersCollectionWithIgnoredHeader    = this.GetHttpHeadersCollection(ignoredHttpHeaderName, ignoredHttpHeaderValue);
            NameValueCollection headersCollectionWithoutIgnoredHeader = this.GetHttpHeadersCollection(null, null);

            // Call HTTP PUT method without ignored header.
            responseForPutRequestWithoutIgnoredHeader = this.Adapter.Put(requestUri, bytesTxtFile, headersCollectionWithoutIgnoredHeader);
            this.ArrayListForDeleteFile.Add(requestUri);

            // Call HTTP DELETE method without ignored header.
            responseForDeleteRequestWithoutIgnoredHeader = this.Adapter.Delete(requestUri, headersCollectionWithoutIgnoredHeader);
            this.RemoveFileUriFromDeleteList(requestUri);

            // Call HTTP PUT method with ignored header.
            responseForPutRequestWithIgnoredHeader = this.Adapter.Put(requestUri, bytesTxtFile, headersCollectionWithIgnoredHeader);
            this.ArrayListForDeleteFile.Add(requestUri);

            // Call HTTP DELETE method with ignored header.
            responseForDeleteRequestWithIgnoredHeader = this.Adapter.Delete(requestUri, headersCollectionWithIgnoredHeader);
            this.RemoveFileUriFromDeleteList(requestUri);

            string errorLog = string.Empty;

            this.Site.Log.Add(TestTools.LogEntryKind.Comment, "The ignored header is {0}. The ignored header value is {1}.", ignoredHttpHeaderName, ignoredHttpHeaderValue);

            #region Compare the two responses of HTTP PUT method
            this.Site.Log.Add(TestTools.LogEntryKind.Comment, "Compare the two responses of HTTP PUT method.");

            // Compare status code values in the two response.
            bool isSameStatusCode_Put = false;
            if (responseForPutRequestWithIgnoredHeader.StatusCode == responseForPutRequestWithoutIgnoredHeader.StatusCode)
            {
                isSameStatusCode_Put = true;
            }
            else
            {
                isSameStatusCode_Put = false;
                errorLog             = "Test Failed: The status codes in two response are not same! \r\n";
                errorLog            += string.Format("responseForPutRequestWithIgnoredHeader.StatusCode={0}\r\n", (int)responseForPutRequestWithIgnoredHeader.StatusCode);
                errorLog            += string.Format("responseForPutRequestWithoutIgnoredHeader.StatusCode={0}\r\n", (int)responseForPutRequestWithoutIgnoredHeader.StatusCode);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare status description values in the two response.
            bool isSameStatusDescription_Put = false;
            if (string.Compare(responseForPutRequestWithIgnoredHeader.StatusDescription, responseForPutRequestWithoutIgnoredHeader.StatusDescription, true) == 0)
            {
                isSameStatusDescription_Put = true;
            }
            else
            {
                isSameStatusDescription_Put = false;
                errorLog  = "Test Failed: The status description in two response are not same! \r\n";
                errorLog += string.Format("responseForPutRequestWithIgnoredHeader.StatusDescription={0}\r\n", responseForPutRequestWithIgnoredHeader.StatusDescription);
                errorLog += string.Format("responseForPutRequestWithoutIgnoredHeader.StatusDescription={0}\r\n", responseForPutRequestWithoutIgnoredHeader.StatusDescription);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Judge if the two response for PUT methods are same.
            bool isSameResponse_Put = false;
            if (isSameStatusCode_Put && isSameStatusDescription_Put)
            {
                isSameResponse_Put = true;
            }

            #endregion Compare the two responses of HTTP PUT method

            #region Compare the two responses of HTTP DELETE method
            this.Site.Log.Add(TestTools.LogEntryKind.Comment, "Compare the two responses of HTTP DELETE method.");

            // Compare status code values in the two response.
            bool isSameStatusCode_Delete = false;
            if (responseForDeleteRequestWithIgnoredHeader.StatusCode == responseForDeleteRequestWithoutIgnoredHeader.StatusCode)
            {
                isSameStatusCode_Delete = true;
            }
            else
            {
                isSameStatusCode_Delete = false;
                errorLog  = "Test Failed: The status codes in two response are not same! \r\n";
                errorLog += string.Format("responseForDeleteRequestWithIgnoredHeader.StatusCode={0}\r\n", (int)responseForDeleteRequestWithIgnoredHeader.StatusCode);
                errorLog += string.Format("responseForDeleteRequestWithoutIgnoredHeader.StatusCode={0}\r\n", (int)responseForDeleteRequestWithoutIgnoredHeader.StatusCode);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare status description values in the two response.
            bool isSameStatusDescription_Delete = false;
            if (string.Compare(responseForDeleteRequestWithIgnoredHeader.StatusDescription, responseForDeleteRequestWithoutIgnoredHeader.StatusDescription, true) == 0)
            {
                isSameStatusDescription_Delete = true;
            }
            else
            {
                isSameStatusDescription_Delete = false;
                errorLog  = "Test Failed: The status description in two response are not same! \r\n";
                errorLog += string.Format("responseForDeleteRequestWithIgnoredHeader.StatusDescription={0}\r\n", responseForDeleteRequestWithIgnoredHeader.StatusDescription);
                errorLog += string.Format("responseForDeleteRequestWithoutIgnoredHeader.StatusDescription={0}\r\n", responseForDeleteRequestWithoutIgnoredHeader.StatusDescription);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Judge if the two response for PUT methods are same.
            bool isSameResponse_Delete = false;
            if (isSameStatusCode_Delete && isSameStatusDescription_Delete)
            {
                isSameResponse_Delete = true;
            }

            #endregion Compare the two responses of HTTP DELETE method

            // Judge if the responses in PUT and DELETE methods are same.
            bool isSameResponse = false;
            if (isSameResponse_Put && isSameResponse_Delete)
            {
                isSameResponse = true;
            }

            return(isSameResponse);
        }
        /// <summary>
        /// The method will call HTTP GET method twice, in the first time the HTTP GET request includes the ignored header,
        /// and in the second time the HTTP GET request does NOT include the ignored header.
        /// And then the help method compare the key data in the two HTTP responses, if they are same then the help method return true, else return false.
        /// </summary>
        /// <param name="requestUri">The request URI that is used in HTTP GET method</param>
        /// <param name="ignoredHttpHeaderName">The ignored header name.</param>
        /// <param name="ignoredHttpHeaderValue">The ignored header value.</param>
        /// <returns>Return true if the key data are same by comparing the responses, else return false.</returns>
        private bool CompareHttpResponses_Get(string requestUri, string ignoredHttpHeaderName, string ignoredHttpHeaderValue)
        {
            this.Site.Assert.IsNotNull(requestUri, "In CompareHttpResponses_Get method, the request URI should not be null!");
            this.Site.Assert.IsTrue(requestUri != string.Empty, "In CompareHttpResponses_Get method, the request URI should not be empty string!");
            this.Site.Assert.IsNotNull(ignoredHttpHeaderName, "In CompareHttpResponses_Get method, the ignored header name should not be null!");
            this.Site.Assert.IsNotNull(ignoredHttpHeaderValue, "In CompareHttpResponses_Get method, the ignored header value should not be null!");
            this.Site.Assert.IsTrue(ignoredHttpHeaderName != string.Empty, "In CompareHttpResponses_Get method, the ignored header name should not be empty string!");
            this.Site.Assert.IsTrue(ignoredHttpHeaderValue != string.Empty, "In CompareHttpResponses_Get method, the ignored header value should not be empty string!");

            // Call HTTP GET method with ignored header.
            WDVMODUUResponse    responseForGetRequestWithIgnoredHeader = null;
            NameValueCollection headersCollectionWithIgnoredHeader     = this.GetHttpHeadersCollection(ignoredHttpHeaderName, ignoredHttpHeaderValue);

            responseForGetRequestWithIgnoredHeader = this.Adapter.Get(requestUri, headersCollectionWithIgnoredHeader);

            // Call HTTP GET method without ignored header.
            WDVMODUUResponse    responseForGetRequestWithoutIgnoredHeader = null;
            NameValueCollection headersCollectionWithoutIgnoredHeader     = this.GetHttpHeadersCollection(null, null);

            responseForGetRequestWithoutIgnoredHeader = this.Adapter.Get(requestUri, headersCollectionWithoutIgnoredHeader);

            string errorLog = string.Empty;

            this.Site.Log.Add(TestTools.LogEntryKind.Comment, "The ignored header is {0}. The ignored header value is {1}.", ignoredHttpHeaderName, ignoredHttpHeaderValue);

            #region Compare the two responses of HTTP GET method
            this.Site.Log.Add(TestTools.LogEntryKind.Comment, "Compare the two responses of HTTP GET method.");

            // Compare status code values in the two response.
            bool isSameStatusCode = false;
            if (responseForGetRequestWithIgnoredHeader.StatusCode == responseForGetRequestWithoutIgnoredHeader.StatusCode)
            {
                isSameStatusCode = true;
            }
            else
            {
                isSameStatusCode = false;
                errorLog         = "Test Failed: The status codes in two response are not same! \r\n";
                errorLog        += string.Format("responseForGetRequestWithIgnoredHeader.StatusCode={0}\r\n", (int)responseForGetRequestWithIgnoredHeader.StatusCode);
                errorLog        += string.Format("responseForGetRequestWithoutIgnoredHeader.StatusCode={0}\r\n", (int)responseForGetRequestWithoutIgnoredHeader.StatusCode);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare status description values in the two response.
            bool isSameStatusDescription = false;
            if (string.Compare(responseForGetRequestWithIgnoredHeader.StatusDescription, responseForGetRequestWithoutIgnoredHeader.StatusDescription, true) == 0)
            {
                isSameStatusDescription = true;
            }
            else
            {
                isSameStatusDescription = false;
                errorLog  = "Test Failed: The status description in two response are not same! \r\n";
                errorLog += string.Format("responseForGetRequestWithIgnoredHeader.StatusDescription={0}\r\n", responseForGetRequestWithIgnoredHeader.StatusDescription);
                errorLog += string.Format("responseForGetRequestWithoutIgnoredHeader.StatusDescription={0}\r\n", responseForGetRequestWithoutIgnoredHeader.StatusDescription);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare content length values in the two response.
            bool isSameContentLength = false;
            if (responseForGetRequestWithIgnoredHeader.ContentLength == responseForGetRequestWithoutIgnoredHeader.ContentLength)
            {
                isSameContentLength = true;
            }
            else
            {
                isSameContentLength = false;
                errorLog            = "Test Failed: The content length in two response are not same! \r\n";
                errorLog           += string.Format("responseForGetRequestWithIgnoredHeader.ContentLength={0}\r\n", responseForGetRequestWithIgnoredHeader.ContentLength);
                errorLog           += string.Format("responseForGetRequestWithoutIgnoredHeader.ContentLength={0}\r\n", responseForGetRequestWithoutIgnoredHeader.ContentLength);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare content type values in the two response.
            bool isSameContentType = false;
            if (string.Compare(responseForGetRequestWithIgnoredHeader.ContentType, responseForGetRequestWithoutIgnoredHeader.ContentType, true) == 0)
            {
                isSameContentType = true;
            }
            else
            {
                isSameContentType = false;
                errorLog          = "Test Failed: The content type in two response are not same! \r\n";
                errorLog         += string.Format("responseForGetRequestWithIgnoredHeader.ContentType={0}\r\n", responseForGetRequestWithIgnoredHeader.ContentType);
                errorLog         += string.Format("responseForGetRequestWithoutIgnoredHeader.ContentType={0}\r\n", responseForGetRequestWithoutIgnoredHeader.ContentType);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }

            // Compare body data values in the two response.
            bool isSameBodyData = false;
            if (responseForGetRequestWithIgnoredHeader.BodyData == responseForGetRequestWithoutIgnoredHeader.BodyData)
            {
                isSameBodyData = true;
            }
            else
            {
                isSameBodyData = false;
                errorLog       = "Test Failed: The body data in two response are not same! \r\n";
                errorLog      += string.Format("responseForGetRequestWithIgnoredHeader.BodyData={0}\r\n", responseForGetRequestWithIgnoredHeader.BodyData);
                errorLog      += string.Format("responseForGetRequestWithoutIgnoredHeader.BodyData={0}\r\n", responseForGetRequestWithoutIgnoredHeader.BodyData);
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
            }
            #endregion Compare the two responses of HTTP GET method

            // Judge if the two response are same.
            bool isSameResponse = false;
            if (isSameStatusCode && isSameStatusDescription && isSameContentLength && isSameContentType && isSameBodyData)
            {
                isSameResponse = true;
            }

            return(isSameResponse);
        }
        public void MSWDVMODUU_S02_TC03_IgnoredHeaders_UserAgent()
        {
            if (Common.IsRequirementEnabled(128, this.Site))
            {
                string requestUri = Common.GetConfigurationPropertyValue("Server_NewFile001Uri", this.Site);

                // Call HTTP GET method with User-Agent header that include "SyncMan []" comments.
                WDVMODUUResponse    responseForGetRequestWithSyncManComment = null;
                NameValueCollection headersCollectionWithSyncManComment     = this.GetHttpHeadersCollection(null, null);
                headersCollectionWithSyncManComment.Add("User-Agent", "Microsoft Office/12.0 (Windows NT 5.2; SyncMan 12.0.6234; Pro)");
                headersCollectionWithSyncManComment.Add("X-Office-Version", "12.0.6234");
                responseForGetRequestWithSyncManComment = this.Adapter.Get(requestUri, headersCollectionWithSyncManComment);

                // Call HTTP GET method with User-Agent header that does not include "SyncMan []" comments.
                WDVMODUUResponse    responseForGetRequestWithoutSyncManComment = null;
                NameValueCollection headersCollectionWithoutSyncManComment     = this.GetHttpHeadersCollection(null, null);
                headersCollectionWithoutSyncManComment.Add("User-Agent", "Microsoft Office/12.0 (Windows NT 5.2; Pro)");
                headersCollectionWithoutSyncManComment.Add("X-Office-Version", "12.0.6234");
                responseForGetRequestWithoutSyncManComment = this.Adapter.Get(requestUri, headersCollectionWithoutSyncManComment);

                #region Compare the two above responses of HTTP GET method
                string errorLog = string.Empty;

                // Compare status code values in the two response.
                bool isSameStatusCode = false;
                if (responseForGetRequestWithSyncManComment.StatusCode == responseForGetRequestWithoutSyncManComment.StatusCode)
                {
                    isSameStatusCode = true;
                }
                else
                {
                    isSameStatusCode = false;
                    errorLog         = "Test Failed: The status codes in two response are not same! \r\n";
                    errorLog        += string.Format("responseForGetRequestWithSyncManComment.StatusCode={0}\r\n", responseForGetRequestWithSyncManComment.StatusCode);
                    errorLog        += string.Format("responseForGetRequestWithoutSyncManComment.StatusCode={0}\r\n", responseForGetRequestWithoutSyncManComment.StatusCode);
                    this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
                }

                // Compare status description values in the two response.
                bool isSameStatusDescription = false;
                if (string.Compare(responseForGetRequestWithSyncManComment.StatusDescription, responseForGetRequestWithoutSyncManComment.StatusDescription, true) == 0)
                {
                    isSameStatusDescription = true;
                }
                else
                {
                    isSameStatusDescription = false;
                    errorLog  = "Test Failed: The status description in two response are not same! \r\n";
                    errorLog += string.Format("responseForGetRequestWithSyncManComment.StatusDescription={0}\r\n", responseForGetRequestWithSyncManComment.StatusDescription);
                    errorLog += string.Format("responseForGetRequestWithoutSyncManComment.StatusDescription={0}\r\n", responseForGetRequestWithoutSyncManComment.StatusDescription);
                    this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
                }

                // Compare content length values in the two response.
                bool isSameContentLength = false;
                if (responseForGetRequestWithSyncManComment.ContentLength == responseForGetRequestWithoutSyncManComment.ContentLength)
                {
                    isSameContentLength = true;
                }
                else
                {
                    isSameContentLength = false;
                    errorLog            = "Test Failed: The content length in two response are not same! \r\n";
                    errorLog           += string.Format("responseForGetRequestWithSyncManComment.ContentLength={0}\r\n", responseForGetRequestWithSyncManComment.ContentLength);
                    errorLog           += string.Format("responseForGetRequestWithoutSyncManComment.ContentLength={0}\r\n", responseForGetRequestWithoutSyncManComment.ContentLength);
                    this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
                }

                // Compare content type values in the two response.
                bool isSameContentType = false;
                if (string.Compare(responseForGetRequestWithSyncManComment.ContentType, responseForGetRequestWithoutSyncManComment.ContentType, true) == 0)
                {
                    isSameContentType = true;
                }
                else
                {
                    isSameContentType = false;
                    errorLog          = "Test Failed: The content type in two response are not same! \r\n";
                    errorLog         += string.Format("responseForGetRequestWithSyncManComment.ContentType={0}\r\n", responseForGetRequestWithSyncManComment.ContentType);
                    errorLog         += string.Format("responseForGetRequestWithoutSyncManComment.ContentType={0}\r\n", responseForGetRequestWithoutSyncManComment.ContentType);
                    this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
                }

                // Compare body data values in the two response.
                bool isSameBodyData = false;
                if (responseForGetRequestWithSyncManComment.BodyData == responseForGetRequestWithoutSyncManComment.BodyData)
                {
                    isSameBodyData = true;
                }
                else
                {
                    isSameBodyData = false;
                    errorLog       = "Test Failed: The body data in two response are not same! \r\n";
                    errorLog      += string.Format("responseForGetRequestWithSyncManComment.BodyData={0}\r\n", responseForGetRequestWithSyncManComment.BodyData);
                    errorLog      += string.Format("responseForGetRequestWithoutSyncManComment.BodyData={0}\r\n", responseForGetRequestWithoutSyncManComment.BodyData);
                    this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, errorLog);
                }
                #endregion Compare the two above responses of HTTP GET method

                // Capture MS-WDVMODUU_R128, if the key data in the above two responses of HTTP GET method are same.
                bool doesCaptureR128 = false;
                if (isSameStatusCode && isSameStatusDescription && isSameContentLength && isSameContentType && isSameBodyData)
                {
                    doesCaptureR128 = true;
                }

                this.Site.CaptureRequirementIfIsTrue(
                    doesCaptureR128,
                    128,
                    @"[In Appendix B: Product Behavior] Implementation does reply the same response whether ""SyncMan []"" is included in the User-Agent Header or not.[In Appendix B: Product Behavior] <9> Section 2.2.1.9:  Servers running Windows SharePoint Services 3.0 ignore comments [""SyncMan[]""] of this value in the User-Agent Header.");
            }
            else
            {
                this.Site.Assume.Inconclusive("Test is executed only when R128Enabled is set to true.");
            }
        }
示例#14
0
        public void MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Get()
        {
            // Prerequisites for this test case:
            //     The server has installed valid virus scanner software, and a fake virus file that can be detected
            //     by the virus scanner software has existed in a URI under the server.
            //     The URI should be set as the value property "Server_FakeVirusInfectedFileUri_Get" in PTF configuration file.

            // Get the URI of the fake virus file in the server from the property "Server_FakeVirusInfectedFileUri_Get".
            string requestUri = Common.GetConfigurationPropertyValue("Server_FakeVirusInfectedFileUri_Get", this.Site);

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();

            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Depth", "0");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");
            headersCollection.Add("Translate", "f");

            // Call HTTP GET method with the URI of the fake virus file in the server.
            WDVMODUUResponse response        = null;
            HttpWebResponse  httpWebResponse = null;

            try
            {
                response = this.Adapter.Get(requestUri, headersCollection);
                this.Site.Assert.Fail("Failed: The virus file should not be get successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.Conflict)
                {
                    // The expected web exception is "Conflict", if the caught web exception is not "Conflict", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Get', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "409 CONFLICT", and then capture MS-WDVMODUU_R77.
            bool isResponseStatusCode409CONFLICT = false;
            if ((response.StatusCode == HttpStatusCode.Conflict) && (string.Compare(response.StatusDescription, "CONFLICT", true) == 0))
            {
                isResponseStatusCode409CONFLICT = true;
            }

            if (isResponseStatusCode409CONFLICT == false)
            {
                // Log some information to help users to know why the response does not include "409 CONFLICT".
                string helpDebugInformation = @"The status code in the HTTP response is not ""409 CONFLICT"", make sure following conditions are matched, and see more help information under section 1.2.1 in the test suite specification: \r\n ";
                helpDebugInformation += @"1. A valid virus scanner software has been installed in the protocol server, and the virus scanner software must be active when a document is downloaded from the protocol server. \r\n";
                helpDebugInformation += @"2. The fake virus infected file that can be detected by the valid virus scanner software exists in the URI under the protocol server, as specified by the PTF property ""Server_FakeVirusInfectedFileUri_Get"".";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT,
                77,
                @"[In X-Virus-Infected Header] If this [X-Virus-Infected] header is returned by a WebDAV server in response to an HTTP [PUT or a] GET request, the server MUST fail the request and respond with a message containing HTTP status code ""409 CONFLICT"".");

            // Confirm the server does not return the fake virus file in the response with "409 CONFLICT" error condition, and then capture MS-WDVMODUU_R78.
            bool isContentBodyEmpty = false;
            if (response.ContentLength == 0)
            {
                isContentBodyEmpty = true;
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT && isContentBodyEmpty,
                78,
                @"[In X-Virus-Infected Header] [If X-Virus-Infected Header is returned] The server MUST NOT return the infected file to the client following a GET request ""409 CONFLICT"" error condition.");

            // Confirm the server returns the X-Virus-Infected header in the response, and then capture MS-WDVMODUU_R74.
            bool isXVirusInfectedHeaderReturned = false;
            foreach (string headerName in response.HttpHeaders.AllKeys)
            {
                if (string.Compare(headerName, "X-Virus-Infected", true) == 0)
                {
                    isXVirusInfectedHeaderReturned = true;
                    break;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned,
                74,
                @"[In X-Virus-Infected Header] A WebDAV server returns the X-Virus-Infected header in response to an HTTP GET [or a PUT] request to indicate that the requested file is infected with a virus.");

            // Get the X-Virus-Infected header and its value.
            string[] headerAndValues             = response.HttpHeaders.ToString().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string   virusInfectedHeaderAndValue = string.Empty;
            foreach (string headerAndValue in headerAndValues)
            {
                if (headerAndValue.ToLower().IndexOf("x-virus-infected") == 0)
                {
                    virusInfectedHeaderAndValue = headerAndValue;
                    break;
                }
            }

            this.Site.Assert.IsTrue(virusInfectedHeaderAndValue != string.Empty, "The X-Virus-Infected header and its value should not be empty string!");

            // Define a regular expression pattern for the syntax: "x-virus-infected" ":" Virus-Name Virus-Name = 1*TEXT
            // "x-virus-infected" is matching for the header name: "x-virus-infected"
            // ":" is matching the colon which must exist.
            // "\s*" is matching the leading white spaces
            // ".*" is matching the name characters other than \r\n
            string virusHeaderPattern = string.Format(@"x-virus-infected:\s*.*");

            // Check the format of X-Virus-Infected header and its value in the response.
            Site.Log.Add(TestTools.LogEntryKind.Comment, "The X-Virus-Infected header and its value is {0}", virusInfectedHeaderAndValue);
            bool isRightXVirusHeader = Regex.IsMatch(virusInfectedHeaderAndValue, virusHeaderPattern, RegexOptions.IgnoreCase);
            Site.Assert.IsTrue(isRightXVirusHeader, "The format of X-Virus-Infected header should be correct.");

            // Capture MS-WDVMODUU_R7, MS-WDVMODUU_R4, and MS-WDVMODUU_R5, if the format of X-Virus-Infected header and its value is correct.
            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                4,
                @"[In MODUU Extension Headers] The extension headers in this protocol conform to the form and behavior of other custom HTTP 1.1 headers, as specified in [RFC2616] section 4.2.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                5,
                @"[In MODUU Extension Headers] They [The extension headers] are consistent with the WebDAV verbs and headers, as specified in [RFC2518] sections 8 and 9.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                7,
                @"[In X-Virus-Infected Header] If returned, the X-Virus-Infected header MUST take the following form:
X-Virus-Infected Header = ""x-virus-infected"" "":"" Virus-Name
Virus-Name = 1*TEXT");

            #endregion
        }
        public void MSWDVMODUU_S01_TC02_XVirusInfectedHeader_Put()
        {
            // Prerequisites for this test case:
            //     The server has installed valid virus scanner software.
            //     And in the client test environment, under the local output path there is a fake virus file that can be detected by the valid virus scanner software. 
            //     The fake virus file name should be set as the value of property "Client_FakeVirusInfectedFileName" in PTF configuration file.

            // Get the URI of the fake virus file from the property "Server_FakeVirusInfectedFileUri_Put", 
            // the URI will be used as Request-URI in the HTTP PUT method.
            string requestUri = Common.GetConfigurationPropertyValue("Server_FakeVirusInfectedFileUri_Put", this.Site);

            // The fake virus file is under the local output path, and its name is the value of property "Client_FakeVirusInfectedFileName" in PTF configuration file.
            string fakeVirusInfectedFileName = Common.GetConfigurationPropertyValue("Client_FakeVirusInfectedFileName", this.Site);

            // Assert the fake virus infected file is existed in the local folder.
            if (File.Exists(fakeVirusInfectedFileName) == false)
            {
                this.Site.Assert.Fail("The file '{0}' was not found in local output path(such as: <Solution Directory>\\TestSuite\\Resources\\), prepare a fake virus infected file under the local output path, and make sure the name of the file is same as the value of PTF property \"Client_FakeVirusInfectedFileName\".", fakeVirusInfectedFileName);
            }

            // Read the contents of fake virus file in the client. 
            byte[] bytes = GetLocalFileContent(fakeVirusInfectedFileName);

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();
            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");

            // Call HTTP PUT method to upload the fake virus file to the server.
            WDVMODUUResponse response = null;
            HttpWebResponse httpWebResponse = null;
            try
            {
                response = this.Adapter.Put(requestUri, bytes, headersCollection);
                this.ArrayListForDeleteFile.Add(requestUri);
                this.Site.Assert.Fail("Failed: The virus file should not be put successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.Conflict)
                {
                    // The expected web exception is "Conflict", if the caught web exception is not "Conflict", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Put', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "409 CONFLICT", and then capture MS-WDVMODUU_R76.
            bool isResponseStatusCode409CONFLICT = false;
            if ((response.StatusCode == HttpStatusCode.Conflict)
                && (string.Compare(response.StatusDescription, "CONFLICT", true) == 0))
            {
                isResponseStatusCode409CONFLICT = true;
            }

            if (isResponseStatusCode409CONFLICT == false)
            {
                // Log some information to help users to know why the response does not include "409 CONFLICT". 
                string helpDebugInformation = @"The status code in the HTTP response is not ""409 CONFLICT"", make sure following conditions are matched, and see more help information under section 1.2.1 in the test suite specification: \r\n ";
                helpDebugInformation += @"1. A valid virus scanner software has been installed in the protocol server, and virus scanner software must be active when a document is uploaded to the protocol server. \r\n";
                helpDebugInformation += @"2. The fake virus infected file " + fakeVirusInfectedFileName + " can be detected by the valid virus scanner software in the protocol server. \r\n";
                helpDebugInformation += @"3. The URI in the PTF property ""Server_FakeVirusInfectedFileUri_Put"" is an addressable path in the protocol server that the test case has permission to upload a file.";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT,
                76,
                @"[In X-Virus-Infected Header] If this [X-Virus-Infected ] header is returned by a WebDAV server in response to an HTTP PUT[ or a GET] request, the server MUST fail the request and respond with a message containing HTTP status code ""409 CONFLICT"".");

            // Confirm the server returns the X-Virus-Infected header in the response, and then capture MS-WDVMODUU_R75.
            bool isXVirusInfectedHeaderReturned = false;
            foreach (string headerName in response.HttpHeaders.AllKeys)
            {
                if (string.Compare(headerName, "X-Virus-Infected", true) == 0)
                {
                    isXVirusInfectedHeaderReturned = true;
                    break;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned,
                75,
                @"[In X-Virus-Infected Header] A WebDAV server returns the X-Virus-Infected header in response to an HTTP [GET or a ]PUT request to indicate that the requested file is infected with a virus.");

            // Get the X-Virus-Infected header and its value into a string.
            string[] headerAndValues = response.HttpHeaders.ToString().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string virusInfectedHeaderAndValue = string.Empty;
            foreach (string headerAndValue in headerAndValues)
            {
                if (headerAndValue.ToLower().IndexOf("x-virus-infected") == 0)
                {
                    virusInfectedHeaderAndValue = headerAndValue;
                    break;
                }
            }

            this.Site.Assert.IsTrue(virusInfectedHeaderAndValue != string.Empty, "The X-Virus-Infected header and its value should not be empty string!");

            // Define a regular expression pattern for the syntax: "x-virus-infected" ":" Virus-Name Virus-Name = 1*TEXT
            // "x-virus-infected" is matching for the header name: "x-virus-infected"
            // ":" is matching the colon which must exist. 
            // "\s*" is matching the leading white spaces
            // ".*" is matching the name characters other than \r\n 
            string virusHeaderPattern = string.Format(@"^x-virus-infected:\s*.*");

            // Check the format of X-Virus-Infected header and its value in the response.
            Site.Log.Add(TestTools.LogEntryKind.Comment, "The X-Virus-Infected header and its value is {0}", virusInfectedHeaderAndValue);
            bool isRightXVirusHeader = Regex.IsMatch(virusInfectedHeaderAndValue, virusHeaderPattern, RegexOptions.IgnoreCase);
            Site.Assert.IsTrue(isRightXVirusHeader, "The format of X-Virus-Infected header should be correct.");

            // Capture MS-WDVMODUU_R7, MS-WDVMODUU_R4, and MS-WDVMODUU_R5, if the format of X-Virus-Infected header and its value is correct.
            this.Site.CaptureRequirementIfIsTrue(
               isXVirusInfectedHeaderReturned && isRightXVirusHeader,
               4,
               @"[In MODUU Extension Headers] The extension headers in this protocol conform to the form and behavior of other custom HTTP 1.1 headers, as specified in [RFC2616] section 4.2.");

            this.Site.CaptureRequirementIfIsTrue(
               isXVirusInfectedHeaderReturned && isRightXVirusHeader,
               5,
               @"[In MODUU Extension Headers] They [The extension headers] are consistent with the WebDAV verbs and headers, as specified in [RFC2518] sections 8 and 9.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                7,
                @"[In X-Virus-Infected Header] If returned, the X-Virus-Infected header MUST take the following form:
X-Virus-Infected Header = ""x-virus-infected"" "":"" Virus-Name
Virus-Name = 1*TEXT");

            #endregion
        }
 /// <summary>
 /// Assert the return object 'WDVMODUUResponse' is not null, make sure all necessary members in the object are not null.
 /// </summary>
 /// <param name="responseWDVMODUU">The return object 'WDVMODUUResponse' that will be checked.</param>
 private void AssertWDVMODUUResponse(WDVMODUUResponse responseWDVMODUU)
 {
     this.Site.Assert.IsNotNull(responseWDVMODUU, "The response object 'responseWDVMODUU' should not be null!");
     this.Site.Assert.IsNotNull(responseWDVMODUU.HttpHeaders, "The response object 'responseWDVMODUU.HttpHeaders' should not be null!");
     this.Site.Assert.IsNotNull(responseWDVMODUU.ProtocolVersion, "The response object 'responseWDVMODUU.ProtocolVersion' should not be null!");
 }
        public void MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Get()
        {
            // Prerequisites for this test case:
            //     The server has installed valid virus scanner software, and a fake virus file that can be detected 
            //     by the virus scanner software has existed in a URI under the server. 
            //     The URI should be set as the value property "Server_FakeVirusInfectedFileUri_Get" in PTF configuration file.

            // Get the URI of the fake virus file in the server from the property "Server_FakeVirusInfectedFileUri_Get".
            string requestUri = Common.GetConfigurationPropertyValue("Server_FakeVirusInfectedFileUri_Get", this.Site);

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();
            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Depth", "0");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");
            headersCollection.Add("Translate", "f");

            // Call HTTP GET method with the URI of the fake virus file in the server.
            WDVMODUUResponse response = null;
            HttpWebResponse httpWebResponse = null;
            try
            {
                response = this.Adapter.Get(requestUri, headersCollection);
                this.Site.Assert.Fail("Failed: The virus file should not be get successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.Conflict)
                {
                    // The expected web exception is "Conflict", if the caught web exception is not "Conflict", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S01_TC01_XVirusInfectedHeader_Get', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "409 CONFLICT", and then capture MS-WDVMODUU_R77.
            bool isResponseStatusCode409CONFLICT = false;
            if ((response.StatusCode == HttpStatusCode.Conflict) && (string.Compare(response.StatusDescription, "CONFLICT", true) == 0))
            {
                isResponseStatusCode409CONFLICT = true;
            }

            if (isResponseStatusCode409CONFLICT == false)
            {
                // Log some information to help users to know why the response does not include "409 CONFLICT". 
                string helpDebugInformation = @"The status code in the HTTP response is not ""409 CONFLICT"", make sure following conditions are matched, and see more help information under section 1.2.1 in the test suite specification: \r\n ";
                helpDebugInformation += @"1. A valid virus scanner software has been installed in the protocol server, and the virus scanner software must be active when a document is downloaded from the protocol server. \r\n";
                helpDebugInformation += @"2. The fake virus infected file that can be detected by the valid virus scanner software exists in the URI under the protocol server, as specified by the PTF property ""Server_FakeVirusInfectedFileUri_Get"".";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT,
                77,
                @"[In X-Virus-Infected Header] If this [X-Virus-Infected] header is returned by a WebDAV server in response to an HTTP [PUT or a] GET request, the server MUST fail the request and respond with a message containing HTTP status code ""409 CONFLICT"".");

            // Confirm the server does not return the fake virus file in the response with "409 CONFLICT" error condition, and then capture MS-WDVMODUU_R78.
            bool isContentBodyEmpty = false;
            if (response.ContentLength == 0)
            {
                isContentBodyEmpty = true;
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode409CONFLICT && isContentBodyEmpty,
                78,
                @"[In X-Virus-Infected Header] [If X-Virus-Infected Header is returned] The server MUST NOT return the infected file to the client following a GET request ""409 CONFLICT"" error condition.");

            // Confirm the server returns the X-Virus-Infected header in the response, and then capture MS-WDVMODUU_R74.
            bool isXVirusInfectedHeaderReturned = false;
            foreach (string headerName in response.HttpHeaders.AllKeys)
            {
                if (string.Compare(headerName, "X-Virus-Infected", true) == 0)
                {
                    isXVirusInfectedHeaderReturned = true;
                    break;
                }
            }

            this.Site.CaptureRequirementIfIsTrue(
               isXVirusInfectedHeaderReturned,
               74,
               @"[In X-Virus-Infected Header] A WebDAV server returns the X-Virus-Infected header in response to an HTTP GET [or a PUT] request to indicate that the requested file is infected with a virus.");

            // Get the X-Virus-Infected header and its value.
            string[] headerAndValues = response.HttpHeaders.ToString().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string virusInfectedHeaderAndValue = string.Empty;
            foreach (string headerAndValue in headerAndValues)
            {
                if (headerAndValue.ToLower().IndexOf("x-virus-infected") == 0)
                {
                    virusInfectedHeaderAndValue = headerAndValue;
                    break;
                }
            }

            this.Site.Assert.IsTrue(virusInfectedHeaderAndValue != string.Empty, "The X-Virus-Infected header and its value should not be empty string!");

            // Define a regular expression pattern for the syntax: "x-virus-infected" ":" Virus-Name Virus-Name = 1*TEXT
            // "x-virus-infected" is matching for the header name: "x-virus-infected"
            // ":" is matching the colon which must exist. 
            // "\s*" is matching the leading white spaces
            // ".*" is matching the name characters other than \r\n 
            string virusHeaderPattern = string.Format(@"x-virus-infected:\s*.*");

            // Check the format of X-Virus-Infected header and its value in the response.
            Site.Log.Add(TestTools.LogEntryKind.Comment, "The X-Virus-Infected header and its value is {0}", virusInfectedHeaderAndValue);
            bool isRightXVirusHeader = Regex.IsMatch(virusInfectedHeaderAndValue, virusHeaderPattern, RegexOptions.IgnoreCase);
            Site.Assert.IsTrue(isRightXVirusHeader, "The format of X-Virus-Infected header should be correct.");

            // Capture MS-WDVMODUU_R7, MS-WDVMODUU_R4, and MS-WDVMODUU_R5, if the format of X-Virus-Infected header and its value is correct.
            this.Site.CaptureRequirementIfIsTrue(
               isXVirusInfectedHeaderReturned && isRightXVirusHeader,
               4,
               @"[In MODUU Extension Headers] The extension headers in this protocol conform to the form and behavior of other custom HTTP 1.1 headers, as specified in [RFC2616] section 4.2.");

            this.Site.CaptureRequirementIfIsTrue(
               isXVirusInfectedHeaderReturned && isRightXVirusHeader,
               5,
               @"[In MODUU Extension Headers] They [The extension headers] are consistent with the WebDAV verbs and headers, as specified in [RFC2518] sections 8 and 9.");

            this.Site.CaptureRequirementIfIsTrue(
                isXVirusInfectedHeaderReturned && isRightXVirusHeader,
                7,
                @"[In X-Virus-Infected Header] If returned, the X-Virus-Infected header MUST take the following form:
X-Virus-Infected Header = ""x-virus-infected"" "":"" Virus-Name
Virus-Name = 1*TEXT");

            #endregion
        }
        public void MSWDVMODUU_S04_TC01_MSBinDiffHeader_Put()
        {
            // Get the request URI from the property "Server_TestTxtFileUri_Put".
            string requestUri = Common.GetConfigurationPropertyValue("Server_TestTxtFileUri_Put", this.Site);

            // Get file name from the property "Client_TestTxtFileName", and read its content into byte array.
            byte[] bytesTxtFile = GetLocalFileContent(Common.GetConfigurationPropertyValue("Client_TestTxtFileName", this.Site));

            // Construct the request headers.
            NameValueCollection headersCollection = new NameValueCollection();

            headersCollection.Add("MS-BinDiff", "1.0");
            headersCollection.Add("Cache-Control", "no-cache");
            headersCollection.Add("Pragma", "no-cache");
            headersCollection.Add("ProtocolVersion", "HTTP/1.1");


            // Call HTTP PUT method to upload the file to the server.
            WDVMODUUResponse response        = null;
            HttpWebResponse  httpWebResponse = null;

            try
            {
                response = this.Adapter.Put(requestUri, bytesTxtFile, headersCollection);
                this.ArrayListForDeleteFile.Add(requestUri);
                this.Site.Assert.Fail("Failed: The file should not be put successfully! \r\n The last request is:\r\n {0} The last response is: \r\n {1}", this.Adapter.LastRawRequest, this.Adapter.LastRawResponse);
            }
            catch (WebException webException)
            {
                this.Site.Assert.IsNotNull(webException.Response, "The 'Response' in the caught web exception should not be null!");
                httpWebResponse = (HttpWebResponse)webException.Response;
                if (httpWebResponse.StatusCode != HttpStatusCode.UnsupportedMediaType)
                {
                    // The expected web exception is "Unsupported Media Type", if the caught web exception is not "Unsupported Media Type", then throw the web exception to the framework.
                    throw;
                }

                response = new WDVMODUUResponse();
                response.ReserveResponseData(httpWebResponse, this.Site);
            }

            this.Site.Log.Add(
                TestTools.LogEntryKind.Comment,
                string.Format("In Method 'MSWDVMODUU_S04_TC01_MSBinDiffHeader_Put', the request URI is {0}. In the response, the status code is '{1}'; the status description is '{2}'.", requestUri, response.StatusCode, response.StatusDescription));

            #region Verify Requirements

            // Confirm the server fails the request and respond with a message containing HTTP status code "415 UNSUPPORTED MEDIA TYPE", and then capture MS-WDVMODUU_R901.
            bool isResponseStatusCode415UNSUPPORTEDMEDIATYPE = false;
            if ((response.StatusCode == HttpStatusCode.UnsupportedMediaType) &&
                (string.Compare(response.StatusDescription, "UNSUPPORTED MEDIA TYPE", true) == 0))
            {
                isResponseStatusCode415UNSUPPORTEDMEDIATYPE = true;
            }

            if (isResponseStatusCode415UNSUPPORTEDMEDIATYPE == false)
            {
                // Log some information to help users to know why the response does not include "415 UNSUPPORTED MEDIA TYPE".
                string helpDebugInformation = @"The status code in the HTTP response is not ""415 UNSUPPORTED MEDIA TYPE""\r\n ";
                this.Site.Log.Add(TestTools.LogEntryKind.TestFailed, helpDebugInformation);
            }

            this.Site.CaptureRequirementIfIsTrue(
                isResponseStatusCode415UNSUPPORTEDMEDIATYPE,
                901,
                @"[In MS-BinDiff Header] If the MS-BinDiff header is included in an HTTP PUT request, the server MUST fail the request and response with a message containing HTTP status code ""415 UNSUPPORTED MEDIA TYPE"".");

            #endregion
        }