/// <summary>
        /// This operation is used to delete all the previous versions of the specified file except
        /// the published version and the current version.
        /// </summary>
        /// <param name="fileName">The site-relative path of the file which will be deleted.</param>
        /// <returns>The response message for deleting all previous versions of
        /// the specified file on the protocol server.</returns>
        public DeleteAllVersionsResponseDeleteAllVersionsResult DeleteAllVersions(string fileName)
        {
            try
            {
                DeleteAllVersionsResponseDeleteAllVersionsResult deleteAllVersionsResult =
                    this.service.DeleteAllVersions(fileName);

                this.VerifyTransport();
                this.VerifySOAPVersion(this.service.SoapVersion);
                this.VerifyDeleteAllVersions(deleteAllVersionsResult, SchemaValidation.LastRawResponseXml.OuterXml);
                return(deleteAllVersionsResult);
            }
            catch (SoapException soapException)
            {
                this.VerifySOAPFaultDetails(soapException, SchemaValidation.LastRawResponseXml.OuterXml);
                throw;
            }
            catch (WebException)
            {
                this.VerifyServerFaults();
                throw;
            }
        }
        /// <summary>
        /// Verify the DeleteAllVersions operation related requirements.
        /// </summary>
        /// <param name="deleteAllversionsResult">The DeleteAllVersionsResponseDeleteAllVersionsResult object
        /// indicates DeleteAllVersions operation response.</param>
        /// <param name="soapBody">The string value indicates the SOAP body in DeleteAllVersions operation response.</param>
        private void VerifyDeleteAllVersions(
            DeleteAllVersionsResponseDeleteAllVersionsResult deleteAllversionsResult,
            string soapBody)
        {
            bool isSchemaVerified = SchemaValidation.ValidationResult.Equals(ValidationResult.Success);

            #region Verify MS-VERSS_R80
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R80");

            // Verify MS-VERSS requirement: MS-VERSS_R80
            Site.CaptureRequirementIfIsTrue(
                isSchemaVerified,
                80,
                @"[In DeleteAllVersions operation][The schema of DeleteAllVersions is defined as:]
<wsdl:operation name=""DeleteAllVersions"">
    <wsdl:input message=""tns:DeleteAllVersionsSoapIn"" />
    <wsdl:output message=""tns:DeleteAllVersionsSoapOut"" />
</wsdl:operation>");
            #endregion

            #region Verify MS-VERSS_R82
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R82");

            // Verify MS-VERSS requirement: MS-VERSS_R82
            Site.CaptureRequirementIfIsNotNull(
                deleteAllversionsResult,
                82,
                @"[In DeleteAllVersions operation] [The protocol client sends a DeleteAllVersionsSoapIn request message], and the protocol server responds with a DeleteAllVersionsSoapOut response message.");
            #endregion

            #region Verify MS-VERSS_R88
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R88");

            bool isR88Verified = AdapterHelper.IsExistElementInSoapBody(soapBody, "DeleteAllVersionsResponse");

            // Verify MS-VERSS requirement: MS-VERSS_R88
            Site.CaptureRequirementIfIsTrue(
                isR88Verified,
                88,
                @"[In DeleteAllVersionsSoapOut] The SOAP body contains a DeleteAllVersionsResponse element.");
            #endregion

            #region Verify MS-VERSS_R91
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R91");

            // Verify MS-VERSS requirement: MS-VERSS_R91
            Site.CaptureRequirementIfIsTrue(
                isSchemaVerified,
                91,
                @"[In DeleteAllVersionsResponse][The schema of DeleteAllVersionsResponse element is defined as:]  
<s:element name=""DeleteAllVersionsResponse"">
  <s:complexType>
    <s:sequence>
      <s:element minOccurs=""1"" maxOccurs=""1"" name=""DeleteAllVersionsResult"">
        <s:complexType>
          <s:sequence>
            <s:element name=""results"" minOccurs=""1"" maxOccurs=""1"" type=""tns:Results"" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:sequence>
  </s:complexType>
</s:element>");
            #endregion

            this.VerifyResultsComplexType(deleteAllversionsResult.results, isSchemaVerified);
        }
        /// <summary>
        /// A common method used to verify that the client can get expected DeleteAllVersionsSoapOut and
        /// GetVersionsSoapOut messages by calling DeleteAllVersions and GetVersions operations with the URL of a file.
        /// </summary>
        /// <param name="url">The URL of a file.</param>
        private void DeleteAllVersionsVerification(string url)
        {
            // Enable the versioning of the list.
            bool setVersioning = this.sutControlAdapterInstance.SetVersioning(this.documentLibrary, true, true);

            Site.Assert.IsTrue(
                setVersioning,
                "SetVersioning operation returns {0}, TRUE means the operation was executed successfully, " +
                "FALSE means the operation failed",
                setVersioning);

            // Upload the file into specific list.
            bool isAddFileSuccessful = this.sutControlAdapterInstance.AddFile(this.documentLibrary, this.fileName, TestSuiteHelper.UploadFileName);

            Site.Assert.IsTrue(
                isAddFileSuccessful,
                "AddFile operation returns {0}, TRUE means the operation was executed successfully, " +
                " FALSE means the operation failed",
                isAddFileSuccessful);

            // Check out and check in file one time to create a new version of the file.
            this.testSuiteHelper.AddOneFileVersion(this.fileName);

            // Call SUT Control Adapter method SetFilePublish to publish the current version of the file.
            bool isFilePublished = this.sutControlAdapterInstance.SetFilePublish(this.documentLibrary, this.fileName, true);

            Site.Assert.IsTrue(
                isFilePublished,
                "SetFilePublish operation returns {0}, TRUE means the operation was executed successfully," +
                " FALSE means the operation failed",
                isFilePublished);

            // Call GetVersions with the relative filename to get details about all versions of the file.
            GetVersionsResponseGetVersionsResult getVersionsResponse = this.protocolAdapterInstance.GetVersions(url);

            // Verify the GetVersions response results.
            this.testSuiteHelper.VerifyResultsInformation(getVersionsResponse.results, OperationName.GetVersions, true);

            // Get previous version before DeleteAllVersions operation by using the results element in the response of GetVersions.
            string previousVersion = AdapterHelper.GetPreviousVersion(getVersionsResponse.results.result);

            // Get the published version information by using the results element in the response of GetVersions.
            string publishedVersion = AdapterHelper.GetCurrentVersion(getVersionsResponse.results.result);

            // Check out and check in file one time to create a new version of the file.
            this.testSuiteHelper.AddOneFileVersion(this.fileName);

            // Call GetVersions with the relative filename to get details about all versions of the file.
            getVersionsResponse = this.protocolAdapterInstance.GetVersions(url);

            // Get the current version information by using the results element in the response of GetVersions.
            string currentVersion = AdapterHelper.GetCurrentVersion(getVersionsResponse.results.result);

            // Enable the Recycle Bin.
            bool isRecycleBinEnable = this.sutControlAdapterInstance.SetRecycleBinEnable(true);

            Site.Assert.IsTrue(
                isRecycleBinEnable,
                "SetRecycleBinEnable operation returns {0}, TRUE means the operation was executed successfully," +
                " FALSE means the operation failed",
                isRecycleBinEnable);

            // Call DeleteAllVersions operation with the relative filename to delete all the previous versions except
            // the published version and the current version.
            DeleteAllVersionsResponseDeleteAllVersionsResult deleteAllVersionsResponse =
                this.protocolAdapterInstance.DeleteAllVersions(url);

            // Verify DeleteAllVersions response results.
            this.testSuiteHelper.VerifyResultsInformation(deleteAllVersionsResponse.results, OperationName.DeleteAllVersions, true);

            // Verify whether the published version and the current version exist in the results element in the response
            // of DeleteAllVersions.
            bool isCurrentVersionExist =
                AdapterHelper.IsVersionExist(deleteAllVersionsResponse.results.result, currentVersion);
            bool isPublishedVersionExist = AdapterHelper.IsVersionExist(
                deleteAllVersionsResponse.results.result,
                publishedVersion);

            Site.Assert.IsTrue(
                isCurrentVersionExist,
                "The DeleteAllVersions operation should not delete the current version {0}",
                currentVersion);

            Site.Assert.IsTrue(
                isPublishedVersionExist,
                "The DeleteAllVersions operation should not delete the published version {0}",
                publishedVersion);

            // Verify whether the previous version exists in the results element in the response of DeleteAllVersions.
            bool isPreviousVersionExist = AdapterHelper.IsVersionExist(deleteAllVersionsResponse.results.result, previousVersion);

            Site.Assert.IsFalse(
                isPreviousVersionExist,
                "The DeleteAllVersions operation should delete the previous version {0}",
                previousVersion);

            // Since all the previous versions of the specified file do not exist, except for the published version and the current version, capture requirement MS-VERSS_R79.
            Site.CaptureRequirement(
                79,
                @"[In DeleteAllVersions operation] The DeleteAllVersions operation deletes all the previous versions of the specified file, except for the published version and the current version. ");

            bool isDeleteFileVersionExistInRecycleBin = false;
            bool isDeleted = false;

            foreach (VersionData versionData in getVersionsResponse.results.result)
            {
                isDeleted = !AdapterHelper.IsVersionExist(deleteAllVersionsResponse.results.result, versionData.version);
                if (isDeleted)
                {
                    // Verify whether the deleted versions exist in the Recycle Bin.
                    isDeleteFileVersionExistInRecycleBin = this.sutControlAdapterInstance.IsFileExistInRecycleBin(
                        this.fileName,
                        versionData.version);

                    if (!isDeleteFileVersionExistInRecycleBin)
                    {
                        break;
                    }
                }
            }

            // Verify MS-VERSS requirement: MS-VERSS_R169
            Site.CaptureRequirementIfIsTrue(
                isDeleteFileVersionExistInRecycleBin,
                169,
                @"[In DeleteAllVersions operation] If the Recycle Bin is enabled, the versions are placed in the Recycle Bin, instead.");
        }
        /// <summary>
        /// Verify the DeleteAllVersions operation related requirements.
        /// </summary>
        /// <param name="deleteAllversionsResult">The DeleteAllVersionsResponseDeleteAllVersionsResult object
        /// indicates DeleteAllVersions operation response.</param>
        /// <param name="soapBody">The string value indicates the SOAP body in DeleteAllVersions operation response.</param>
        private void VerifyDeleteAllVersions(
            DeleteAllVersionsResponseDeleteAllVersionsResult deleteAllversionsResult,
            string soapBody)
        {
            bool isSchemaVerified = SchemaValidation.ValidationResult.Equals(ValidationResult.Success);

            #region Verify MS-VERSS_R80
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R80");

            // Verify MS-VERSS requirement: MS-VERSS_R80
            Site.CaptureRequirementIfIsTrue(
                isSchemaVerified,
                80,
                @"[In DeleteAllVersions operation][The schema of DeleteAllVersions is defined as:]
<wsdl:operation name=""DeleteAllVersions"">
    <wsdl:input message=""tns:DeleteAllVersionsSoapIn"" />
    <wsdl:output message=""tns:DeleteAllVersionsSoapOut"" />
</wsdl:operation>");
            #endregion

            #region Verify MS-VERSS_R82
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R82");

            // Verify MS-VERSS requirement: MS-VERSS_R82
            Site.CaptureRequirementIfIsNotNull(
                deleteAllversionsResult,
                82,
                @"[In DeleteAllVersions operation] [The protocol client sends a DeleteAllVersionsSoapIn request message], and the protocol server responds with a DeleteAllVersionsSoapOut response message.");
            #endregion

            #region Verify MS-VERSS_R88
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R88");

            bool isR88Verified = AdapterHelper.IsExistElementInSoapBody(soapBody, "DeleteAllVersionsResponse");

            // Verify MS-VERSS requirement: MS-VERSS_R88
            Site.CaptureRequirementIfIsTrue(
                isR88Verified,
                88,
                @"[In DeleteAllVersionsSoapOut] The SOAP body contains a DeleteAllVersionsResponse element.");
            #endregion

            #region Verify MS-VERSS_R91
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-VERSS_R91");

            // Verify MS-VERSS requirement: MS-VERSS_R91
            Site.CaptureRequirementIfIsTrue(
                isSchemaVerified,
                91,
                @"[In DeleteAllVersionsResponse][The schema of DeleteAllVersionsResponse element is defined as:]  
<s:element name=""DeleteAllVersionsResponse"">
  <s:complexType>
    <s:sequence>
      <s:element minOccurs=""1"" maxOccurs=""1"" name=""DeleteAllVersionsResult"">
        <s:complexType>
          <s:sequence>
            <s:element name=""results"" minOccurs=""1"" maxOccurs=""1"" type=""tns:Results"" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:sequence>
  </s:complexType>
</s:element>");
            #endregion

            this.VerifyResultsComplexType(deleteAllversionsResult.results, isSchemaVerified);
        }