Inheritance: SubResponseType
        /// <summary>
        /// Capture requirements related to coauthoring sub response.
        /// </summary>
        /// <param name="coauthSubResponse">The coauthoring response.</param>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        public static void ValidateCoauthSubResponse(CoauthSubResponseType coauthSubResponse, ITestSite site)
        {
            ValidateSubResponseType(coauthSubResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4687
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CoauthSubResponseType),
                     coauthSubResponse.GetType(),
                     "MS-FSSHTTP",
                     4687,
                     @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: CoauthSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5742
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CoauthSubResponseType),
                     coauthSubResponse.GetType(),
                     "MS-FSSHTTP",
                     5742,
                     @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: CoauthSubResponseType.");

            if (string.Compare("Success", coauthSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1496
                bool isVerifyR1496 = coauthSubResponse.SubResponseData != null;

                // If the coauthSubResponse.SubResponseData is null, the case run fail.
                site.Assert.IsTrue(
                            isVerifyR1496,
                            "For requirement MS-FSSHTTP_R1496, the SubResponseData should not be NULL.");

                // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message,
                // so this requirement can be captured.
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         1496,
                         @"[In CoauthSubResponseType] As part of processing the coauthoring subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
                         The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");

                // Add the log information.
                site.Log.Add(LogEntryKind.Debug, "Verify MS-FSSHTTP_R267:the returned SubResponseData is {0}", coauthSubResponse.SubResponseData.ToString());

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R267
                // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message,
                // so this requirement can be captured.
                bool isVerifyR267 = coauthSubResponse.SubResponseData != null;
                site.CaptureRequirementIfIsTrue(
                         isVerifyR267,
                         "MS-FSSHTTP",
                         267,
                         @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""Coauth"".");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R624
            // If the coauthoring subResponse exists,its schema will have been validated before invoking the method CaptureJoinCoauthoringSessionRelatedRequirements.
            // So MS-FSSHTTP_R624 can be captured.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     624,
                     @"[In CoauthSubResponseType][CoauthSubResponseType schema is:]
                     <xs:complexType name=""CoauthSubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                           <xs:sequence minOccurs=""0"" maxOccurs=""1"">
                              <xs:element name=""SubResponseData"" type=""tns:CoauthSubResponseDataType"" />
                           </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R984
            // Since the subResponse is of type CoauthSubResponseType, so this requirement can be captured.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CoauthSubResponseType),
                     coauthSubResponse.GetType(),
                     "MS-FSSHTTP",
                     984,
                     @"[In Coauth Subrequest][The protocol client sends a coauthoring SubRequest message, which is of type CoauthSubRequestType,] The protocol server responds with a coauthoring SubResponse message, which is of type CoauthSubResponseType as specified in section 2.3.1.8.");

            if (coauthSubResponse.SubResponseData != null)
            {
                ValidateCoauthSubResponseDataType(coauthSubResponse.SubResponseData, site);
            }
        }
        /// <summary>
        /// A method used to capture CoauthSubRequest related requirements when the Coauth operation executes successfully.
        /// </summary>
        /// <param name="response">A return value represents the CoauthSubResponse information.</param>
        private void CaptureSucceedCoauthSubRequest(CoauthSubResponseType response)
        {
            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1013
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         1013,
                         @"[In Coauth Subrequest][The protocol returns results based on the following conditions:] An ErrorCode value of ""Success"" indicates success in processing the coauthoring request.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1473
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         1473,
                         @"[In CoauthSubResponseType] The protocol server sets the value of the ErrorCode attribute to ""Success""  if the protocol server succeeds in processing the coauthoring subrequest.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R931
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         931,
                         @"[In Common Message Processing Rules and Events][The protocol server MUST follow the following common processing rules for all types of subrequests] If the protocol server supports shared locking, the protocol server MUST support at least one of the following subrequests:
                         The coauthoring subrequest.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R355
                Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
                         ErrorCodeType.Success,
                         SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                         "MS-FSSHTTP",
                         355,
                         @"[In GenericErrorCodeTypes] Success indicates that the cell storage service subrequest succeeded for the given URL for the file.");
            }
            else
            {
                Site.Assert.AreEqual<ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                    @"An ErrorCode value of ""Success"" indicates success in processing the coauthoring request.");
            }
        }
        /// <summary>
        /// A method used to capture CoauthStatus related requirements when getting coauthoring status.
        /// </summary>
        /// <param name="response">A return value represents the CoauthSubResponse information.</param>
        private void CaptureCoauthStatusRelatedRequirementsWhenGetCoauthoringStatus(CoauthSubResponseType response)
        {
            // Add the log information.
            Site.Log.Add(
                LogEntryKind.Debug,
                "For the requirement MS-FSSHTTPB_R1432 and MS-FSSHTTP_R934, the coauth status should be returned when operation is \"Get coauthoring status\" and server responds Success");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1432
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.CoauthStatusSpecified,
                         "MS-FSSHTTP",
                         1432,
                         @"[In CoauthSubResponseDataType][CoauthStatusType] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", CoauthStatus MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Get coauthoring status.");

                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.CoauthStatusSpecified,
                         "MS-FSSHTTP",
                         1425,
                         @"[In SubResponseDataOptionalAttributes][CoauthStatus] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the CoauthStatus attribute MUST be specified in a subresponse that is generated in response to one of the following types of cell storage service subrequest operations: A coauthoring subrequest of type ""Get coauthoring status"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R934
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.CoauthStatusSpecified,
                         "MS-FSSHTTP",
                         934,
                         @"[In Common Message Processing Rules and Events][The protocol server MUST follow the following common processing rules for all types of subrequests] If the protocol server supports the coauthoring subrequest, it MUST return a coauthoring status as specified in section 2.3.1.7.");
            }
            else
            {
                Site.Assert.IsTrue(
                    response.SubResponseData.CoauthStatusSpecified,
                    @"If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", CoauthStatus MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Get coauthoring status.");
            }
        }
        /// <summary>
        /// A method used to capture CoauthStatus related requirements when refreshing coauthoring session.
        /// </summary>
        /// <param name="response">A return value represents the CoauthSubResponse information.</param>
        private void CaptureCoauthStatusRelatedRequirementsWhenRefreshCoauthoringSession(CoauthSubResponseType response)
        {
            // Add the log information.
            Site.Log.Add(
                LogEntryKind.Debug,
                "For the requirement MS-FSSHTTPB_R1424 and MS-FSSHTTP_R1431, the coauth status should be returned when operation is \"Refresh coauthoring session\" and server responds Success");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1424
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.CoauthStatusSpecified,
                         "MS-FSSHTTP",
                         1424,
                         @"[In SubResponseDataOptionalAttributes][CoauthStatus] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the CoauthStatus attribute MUST be specified in a subresponse that is generated in response to one of the following types of cell storage service subrequest operations: A coauthoring subrequest of type ""Refresh coauthoring session"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1431
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.CoauthStatusSpecified,
                         "MS-FSSHTTP",
                         1431,
                         @"[In CoauthSubResponseDataType][CoauthStatusType] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", CoauthStatus MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Refresh coauthoring session.");
            }
            else
            {
                Site.Assert.IsTrue(
                    response.SubResponseData.CoauthStatusSpecified,
                    @"[Refresh] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", CoauthStatus MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Refresh coauthoring session.");
            }
        }
        /// <summary>
        /// A method used to capture CoauthStatus related requirements when joining coauthoring session.
        /// </summary>
        /// <param name="response">A return value represents the CoauthSubResponse information.</param>
        private void CaptureCoauthStatusRelatedRequirementsWhenJoinCoauthoringSession(CoauthSubResponseType response)
        {
            Site.Log.Add(
                LogEntryKind.Debug,
                "The implementation does return CoauthStatus attribute when sending a Join coauth subRequest successfully and the subRequest isn't fallen back to an exclusive lock, actual the attribute {0}",
                response.SubResponseData.LockTypeSpecified ? "exist" : "not exist");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.LockTypeSpecified,
                         "MS-FSSHTTP",
                         3330,
                         @"[In Appendix B: Product Behavior] The implementation does return CoauthStatus attribute when sending a Join coauth subRequest successfully and the subRequest isn't fallen back to an exclusive lock subrequest. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");

                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.LockTypeSpecified,
                         "MS-FSSHTTP",
                         3331,
                         @"[In Appendix B: Product Behavior] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the implementation does return CoauthStatus attribute when client tries to join the coauthoring session and the subrequest does not fall back to an exclusive lock subrequest. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
            }
            else
            {
                Site.Assert.IsTrue(
                    response.SubResponseData.LockTypeSpecified,
                    @"If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the implementation does return CoauthStatus attribute when client tries to join the coauthoring session and the subrequest does not fall back to an exclusive lock subrequest. ");
            }
        }
        /// <summary>
        /// A method used to capture LockType related requirements when refreshing coauthoring session.
        /// </summary>
        /// <param name="response">A return value represents the CoauthSubResponse information.</param>
        private void CaptureLockTypeRelatedRequirementsWhenRefreshCoauthoringSession(CoauthSubResponseType response)
        {
            this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "When the request is refresh coauthoring session, for the requirement MS-FSSHTTP_R1430 and MS-FSSHTTP_R1421 the LockTypeSpecified value MUST be true, but actual value is {0}",
                    response.SubResponseData.LockTypeSpecified);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1430
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.LockTypeSpecified,
                         "MS-FSSHTTP",
                         1430,
                         @"[In CoauthSubResponseDataType][LockType] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the LockType attribute MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Refresh coauthoring session.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1421
                Site.CaptureRequirementIfIsTrue(
                         response.SubResponseData.LockTypeSpecified,
                         "MS-FSSHTTP",
                         1421,
                         @"[In SubResponseDataOptionalAttributes] If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the LockType attribute MUST be specified in a subresponse that is generated in response to one of the following types of cell storage service subrequest operations: A coauthoring subrequest of type ""Refresh coauthoring session"".");
            }
            else
            {
                Site.Assert.IsTrue(
                     response.SubResponseData.LockTypeSpecified,
                     @"If the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"", the LockType attribute MUST be specified in a coauthoring subresponse that is generated in response to all of the following types of coauthoring subrequests: Refresh coauthoring session.");
            }
        }