Microsoft.Protocols.TestSuites.MS_LISTSWS.MS_LISTSWSAdapter.VerifyGetListContentTypesOperation C# (CSharp) Method

VerifyGetListContentTypesOperation() private method

Verify the message syntax of GetListContentTypes operation when the response is received successfully.
private VerifyGetListContentTypesOperation ( GetListContentTypesResponseGetListContentTypesResult getListContentTypesResult ) : void
getListContentTypesResult GetListContentTypesResponseGetListContentTypesResult The result of the operation.
return void
        private void VerifyGetListContentTypesOperation(GetListContentTypesResponseGetListContentTypesResult getListContentTypesResult)
        {
            if (getListContentTypesResult != null)
            {
                // Verify R1817
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1817,
                    @"[The schema of GetListContentTypes is defined as:]"
                    + @"<wsdl:operation name=""GetListContentTypes"">"
                    + @"    <wsdl:input message=""GetListContentTypesSoapIn"" />"
                    + @"    <wsdl:output message=""GetListContentTypesSoapOut"" />"
                    + @"</wsdl:operation>");

                // Verify R605
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    605,
                    @"[In GetListContentTypes operation] [If the protocol client sends a "
                    + "GetListContentTypesSoapIn message] the protocol server responds with a "
                    + "GetListContentTypesSoapOut message.");

                // Verify R994
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                this.Site.CaptureRequirement(
                                    "MS-WSSCAML",
                                    994,
                                    @"[The schema definition of XmlDocumentDefinitionCollection is as follows:]<xs:complexType name=""XmlDocumentDefinitionCollection"">
                                        <xs:sequence>
                                          <xs:element name=""XmlDocument"" type=""XmlDocumentDefinition"" minOccurs=""0"" maxOccurs=""unbounded"" />
                                        </xs:sequence>
                                      </xs:complexType>");

                // Verify R1821
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1821,
                    @"[GetListContentTypesSoapOut]The SOAP Body contains a "
                    + @"GetListContentTypesResponse element.");

                // Verify R1829
                // The response have been received successfully, then the following requirement can be captured.
                // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
                Site.CaptureRequirement(
                    1829,
                    @"[The schema of GetListContentTypesResponse is defined as:]"
                    + @"<s:element name=""GetListContentTypesResponse"">"
                    + @"  <s:complexType>"
                    + @"    <s:sequence>"
                    + @"      <s:element name=""GetListContentTypesResult"" minOccurs=""0"">"
                    + @"        <s:complexType mixed=""true"">"
                    + @"          <s:sequence>"
                    + @"            <s:element name=""ContentTypes"" >"
                    + @"              <s:complexType>"
                    + @"                <s:sequence>"
                    + @"                  <s:element name=""ContentType"" maxOccurs=""unbounded"">"
                    + @"                    <s:complexType>"
                    + @"                      <s:sequence>"
                    + @"                        <s:element name=""XmlDocuments"" "
                    + @"                                   type=""core:XmlDocumentDefinitionCollection"" "
                    + @"                                   minOccurs=""0"">"
                    + @"                        </s:element>"
                    + @"                      </s:sequence>"
                    + @"                      <s:attribute name=""Name"" type=""s:string"" use=""required"" />"
                    + @"                      <s:attribute name=""ID"" type=""core:ContentTypeId""  "
                    + @"                                   use=""required"" />"
                    + @"                      <s:attribute name=""Description"" type=""s:string"" "
                    + @"                                   use=""required"" />"
                    + @"                      <s:attribute name=""Scope"" type=""s:string"" use=""required"" />"
                    + @"                      <s:attribute name=""Version"" type=""s:int"" use=""required"" />"
                    + @"                      <s:attribute name=""BestMatch"" type=""tns:TRUEONLY"" "
                    + @"                                   use=""optional"" />"
                    + @"                    </s:complexType>"
                    + @"                  </s:element>"
                    + @"                </s:sequence>"
                    + @"                <s:attribute name=""ContentTypeOrder"" type=""s:string"" use=""optional"" />"
                    + @"              </s:complexType>"
                    + @"            </s:element>"
                    + @"          </s:sequence>"
                    + @"        </s:complexType>"
                    + @"      </s:element>"
                    + @"    </s:sequence>"
                    + @"  </s:complexType>"
                    + @"</s:element>");

                // Verify R1835
                // Ensure the SOAP result is de-serialized successfully.
                Site.Assume.IsNotNull(getListContentTypesResult, "The result of GetListContentTypes operation must not be null.");

                // If the returned ContentType elements are not null, then the following requirement can be captured.
                bool isVerifyR1835 = true;
                foreach (GetListContentTypesResponseGetListContentTypesResultContentTypesContentType ct in getListContentTypesResult.ContentTypes.ContentType)
                {
                    if (ct == null)
                    {
                        isVerifyR1835 = false;
                        break;
                    }
                }

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1835,
                    1835,
                    @"[GetListContentTypesResponse]"
                    + "GetListContentTypesResult.ContentTypes.ContentType: The container element "
                    + "for a single content type, as specified in [MS-WSSCAML] section 2.4.");

                // Verify R1836
                // The response have been received successfully, then the following requirements can be captured.
                // If the response is not received and parsed successfully, the test case will fail before the requirements are captured 
                Site.CaptureRequirement(
                    1836,
                    @"[GetListContentTypesResponse]GetListContentTypesResult.ContentTypes.ContentType.XmlDocuments: 
                    A collection of XML documents associated with this content type, which can include forms and event receiver manifests.");

                // Verify R1837
                // The response have been received successfully, then the following requirements can be captured.
                // If the response is not received and parsed successfully, the test case will fail before the requirements are captured 
                Site.CaptureRequirement(
                    1837,
                    @"[GetListContentTypesResponse]The XmlDocumentDefinitionCollection type is " +
                    "specified in [MS-WSSCAML] section 2.4.12.");

                // Verify R1843
                // If the count of the returned BestMatch elements is not greater than 1, 
                // then the following requirement can be captured.
                int bestMatchCount = 0;
                foreach (GetListContentTypesResponseGetListContentTypesResultContentTypesContentType ct in getListContentTypesResult.ContentTypes.ContentType)
                {
                    if (ct.BestMatchSpecified == true)
                    {
                        bestMatchCount++;
                    }
                }

                bool isVerifyR1843 = bestMatchCount <= 1;
                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1843,
                    1843,
                    @"[GetListContentTypesResponse]"
                    + "GetListContentTypesResult.ContentTypes.ContentType.BestMatch: MUST be "
                    + "specified on at most one ContentType element.");

                // Verify the requirements of the TRUEONLY simple type.
                for (int i = 0; i < getListContentTypesResult.ContentTypes.ContentType.Length; i++)
                {
                    // Get the best match ContentTypeId, if BestMatchSpecified is true then we get it.
                    if (getListContentTypesResult.ContentTypes.ContentType[i].BestMatchSpecified)
                    {
                        this.VerifyTRUEONLY();
                        break;
                    }
                }
            }
        }
MS_LISTSWSAdapter