Microsoft.Protocols.TestSuites.SharedAdapter.MsfsshttpAdapterCapture.ValidateExclusiveLockSubResponse C# (CSharp) Method

ValidateExclusiveLockSubResponse() public static method

Capture requirements related to exclusive lock sub request of type, "Convert to schema lock with co-authoring transition tracked".
public static ValidateExclusiveLockSubResponse ( ExclusiveLockSubResponseType exclusiveLockSubResponse, ITestSite site ) : void
exclusiveLockSubResponse Microsoft.Protocols.TestSuites.Common.ExclusiveLockSubResponseType Containing the subResponse information.
site ITestSite An object provides logging, assertions, and SUT adapters for test code onto its execution context.
return void
        public static void ValidateExclusiveLockSubResponse(ExclusiveLockSubResponseType exclusiveLockSubResponse, ITestSite site)
        {
            ValidateSubResponseType(exclusiveLockSubResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R659
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     659,
                     @"[In ExclusiveLockSubResponseType][ExclusiveLockSubResponseType schema is:]
                     <xs:complexType name=""ExclusiveLockSubResponseType"">
                      <xs:complexContent>
                        <xs:extension base=""tns:SubResponseType"">
                         <xs:sequence minOccurs=""1"" maxOccurs=""1"">
                          <xs:element name=""SubResponseData"" type=""tns:ExclusiveLockSubResponseDataType"" />
                         </xs:sequence>
                        </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1216
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     1216,
                     @"[In ExclusiveLock Subrequest][The protocol client sends an exclusive lock SubRequest message] The protocol server responds with an exclusive lock SubResponse message, which is of type ExclusiveLockSubResponseType as specified in section 2.3.1.12.");

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

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

            if (string.Compare("Success", exclusiveLockSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R264
                // if can launch this method, the schema matches
                bool isVerifyR264 = exclusiveLockSubResponse.SubResponseData != null;

                // If popup the assert, the case run fail. 
                site.Assert.IsTrue(
                            isVerifyR264,
                            "For requirement MS-FSSHTTPB_R264, the SubResponseData should not be NULL.");

                // If the above logic is right, MS-FSSHTTP_R264 can be captured.
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         264,
                         @"[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 ""ExclusiveLock"".");
            }

            if (exclusiveLockSubResponse.SubResponseData != null)
            {
                ValidateExclusiveLockSubResponseDataType(exclusiveLockSubResponse.SubResponseData, site);
            }
        }