/// <summary>
        /// Validate the requirements related to schema for GetDwsMetaData results element.
        /// </summary>
        /// <param name="respResults">Results element in GetDwsMetaDataResult element.</param>
        private void ValidateGetDwsMetaDataResultResults(GetDwsMetaDataResultTypeResults respResults)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R373");

            // Verify MS-DWSS requirement: MS-DWSS_R373
            Site.CaptureRequirement(
                373,
                @"[In Roles] This element[Roles] is defined as follows:
                <xs:element name=""Roles"">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:choice>
                          <xs:element ref=""tns:Error""/>
                          <xs:sequence>
                            <xs:element name=""Role"" maxOccurs=""unbounded"">
                              <xs:complexType>
                                <xs:attribute name=""Name"" type=""xs:string""
                                              use=""required""/>
                                <xs:attribute name=""Type"" type=""tns:RoleType""
                                              use=""required""/>
                                <xs:attribute name=""Description"" type=""xs:string""
                                              use=""required""/>
                              </xs:complexType>
                            </xs:element>
                          </xs:sequence>
                        </xs:choice>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>");

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

            // Verify MS-DWSS requirement: MS-DWSS_R395
            Site.CaptureRequirement(
                395,
                @"[In RoleType] This type is defined as follows:
                  <xs:simpleType name=""RoleType"">
                    <xs:restriction base=""xs:string"">
                      <xs:enumeration value=""None""/>
                      <xs:enumeration value=""Reader""/>
                      <xs:enumeration value=""Contributor""/>
                      <xs:enumeration value=""WebDesigner""/>
                      <xs:enumeration value=""Administrator""/>
                    </xs:restriction>
                  </xs:simpleType>");

            // If MS-DWSS_R373 is verified correctly, it means this requirement can be verified.
            Site.CaptureRequirement(
                252,
                @"[In GetDwsMetaDataResponse] This element [Roles] MUST conform to the element specification in 2.2.3.6.");

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

            // Verify MS-DWSS requirement: MS-DWSS_R246
            Site.CaptureRequirement(
                246,
                @"[In GetDwsMetaDataResponse] It[Results] MUST conform to the following schema:
                <xs:element name=""Results"">
                  <xs:complexType>
                    <xs:sequence>
                       <xs:element name=""SubscribeUrl"" type=""xs:string"" minOccurs=""0""/>
                       <xs:element name=""MtgInstance"" type=""xs:string""/>
                       <xs:element name=""SettingUrl"" type=""xs:string""/>
                   <xs:element name=""PermsUrl"" type=""xs:string""/>
                       <xs:element name=""UserInfoUrl"" type=""xs:string""/>
                       <xs:element ref=""tns:Roles""/>
                   <xs:element ref=""Schema"" type=""xs:string""/>
                       <xs:element ref=""Schema"" type=""xs:string""/>
                       <xs:element ref=""Schema"" type=""xs:string""/>
                       <xs:element ref=""tns:ListInfo""/>
                       <xs:element ref=""tns:ListInfo""/>
                       <xs:element ref=""tns:ListInfo""/>
                   <xs:element name=""Permissions"">
                        <xs:complexType>
                           <xs:choice>
                            <xs:element ref=""tns:Error""/>
                              <xs:sequence>
                                <xs:element name=""ManageSubwebs"" minOccurs=""0""/>
                                <xs:element name=""ManageWeb"" minOccurs=""0""/>
                                <xs:element name=""ManageRoles"" minOccurs=""0""/>
                                <xs:element name=""ManageLists"" minOccurs=""0""/>
                                <xs:element name=""InsertListItems"" minOccurs=""0""/>
                                <xs:element name=""EditListItems"" minOccurs=""0""/>
                                <xs:element name=""DeleteListItems"" minOccurs=""0""/>
                              </xs:sequence>
                            </xs:choice>
                          </xs:complexType>
                      </xs:element>
                      <xs:element name=""HasUniquePerm""/>
                      <xs:element name=""WorkspaceType""/>
                      <xs:element name=""IsADMode""/>
                      <xs:element name=""DocUrl""/>
                      <xs:element name=""Minimal""/>
                    <s:element name=""GetDwsDataResult"" type=""tns:GetDwsDataResultType""/>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>");

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

            // Verify MS-DWSS requirement: MS-DWSS_R620
            Site.CaptureRequirement(
                620,
                @"[In ListInfo] This element[ListInfo] is defined as follows:
                <xs:element name=""ListInfo"">
                  <xs:complexType>
                    <xs:choice>
                      <xs:element ref=""tns:Error"" minOccurs=""0""/>
                      <xs:sequence>
                        <xs:element name=""Moderated"" type=""xs:boolean""/>
                        <xs:element name=""ListPermissions"">
                          <xs:complexType>
                              <xs:sequence>
                                <xs:element name=""InsertListItems"" minOccurs=""0""/>
                                <xs:element name=""EditListItems"" minOccurs=""0""/>
                                <xs:element name=""DeleteListItems"" minOccurs=""0""/>
                                <xs:element name=""ManageLists"" minOccurs=""0""/>
                                <xs:element ref=""tns:Error"" minOccurs=""0""/>
                              </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:choice>
                    <xs:attribute name=""Name"" type=""xs:string"" use=""required""/>
                  </xs:complexType>
                </xs:element>");

            // If MS-DWSS_R620 is verified correctly, this requirements also can be verified directly.
            Site.CaptureRequirement(
                260,
                @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element specified in 3.1.4.8.2.3.");

            // If MS-DWSS_R620 is verified correctly, this requirements also can be verified directly.
            Site.CaptureRequirement(
                262,
                @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element specified in 3.1.4.8.2.3.");

            // If MS-DWSS_R620 is verified correctly, this requirements also can be verified directly.
            Site.CaptureRequirement(
                264,
                @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element specified in 3.1.4.8.2.3.");

            Results results = respResults.Results;

            if (results != null)
            {
                if (results.List != null)
                {
                    this.ValidateListElement(results.List);
                }

                if (results.List1 != null)
                {
                    this.ValidateListElement(results.List1);
                }

                if (results.List2 != null)
                {
                    this.ValidateListElement(results.List2);
                }
            }

            if (respResults.Schema != null)
            {
                // If the Schema is not null, it indicate that the server does return a Schema element as is specified.
                this.Site.CaptureRequirement(
                    861,
                    @"[In Schema] The Schema element is specified in [MS-PRSTFR] section 2.3.1.2. The following XML schema defines the Schema element:
                  <xs:element  name='Schema'>
                    <xs:complexType >
                      <xs:choice  minOccurs='0' maxOccurs='unbounded'>
                        <xs:element  name= 'AttributeType' type='xdr:AttributeType'/>
                        <xs:element  name= 'ElementType' type='xdr:ElementType'/>
                        <xs:element  ref='xdr:description'/>
                        <xs:any  namespace='##other' processContents='skip'/>
                      </xs:choice>
                      <xs:attribute  name='name' type='xs:string/>
                      <xs:attribute  name='id' type='xs:ID/>
                      <xs:anyAttribute  namespace='##other'
                                        processContents='skip'/>
                    </xs:complexType>
                  </xs:element>");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    862,
                    @"[In Schema] AttributeType: Specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    863,
                    @"[In Schema] ElementType: Specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    864,
                    @"[In Schema] description: A description for the Schema element.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    865,
                    @"[In Schema] name: The name of the schema.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    866,
                    @"[In Schema] id: The identifier of the schema. Specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                Site.CaptureRequirement(
                    254,
                    @"[In GetDwsMetaDataResponse] The element[Schema] MUST conform to the Schema element in the xml element specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                Site.CaptureRequirement(
                    256,
                    @"[In GetDwsMetaDataResponse] The element[Schema] MUST conform to the Schema element in the xml element specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                Site.CaptureRequirement(
                    258,
                    @"[In GetDwsMetaDataResponse] This element [Schema] MUST conform to the Schema element in the xml element specified in [MS-PRSTFR] section 2.3.1.2.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Validate the requirements related to schema for GetDwsMetaData results element.
        /// </summary>
        /// <param name="respResults">Results element in GetDwsMetaDataResult element.</param>
        /// <param name="isMinimal">A Boolean value that specifies whether to return information.</param>
        private void ValidateGetDwsMetaDataResultResults(GetDwsMetaDataResultTypeResults respResults, bool isMinimal)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R373");

            // Verify MS-DWSS requirement: MS-DWSS_R373
            Site.CaptureRequirement(
                373,
                @"[In Roles] This element[Roles] is defined as follows:
                <xs:element name=""Roles"">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:choice>
                          <xs:element ref=""tns:Error""/>
                          <xs:sequence>
                            <xs:element name=""Role"" maxOccurs=""unbounded"">
                              <xs:complexType>
                                <xs:attribute name=""Name"" type=""xs:string""
                                              use=""required""/>
                                <xs:attribute name=""Type"" type=""tns:RoleType""
                                              use=""required""/>
                                <xs:attribute name=""Description"" type=""xs:string""
                                              use=""required""/>
                              </xs:complexType>
                            </xs:element>
                          </xs:sequence>
                        </xs:choice>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>");

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

            // Verify MS-DWSS requirement: MS-DWSS_R395
            Site.CaptureRequirement(
                395,
                @"[In RoleType] This type is defined as follows:
                  <xs:simpleType name=""RoleType"">
                    < xs:restriction base = ""xs:string"" >
                      < xs:enumeration value = ""None"" />
                      < xs:enumeration value = ""Reader"" />
                      < xs:enumeration value = ""Contributor"" />
                      < xs:enumeration value = ""WebDesigner"" />
                      < xs:enumeration value = ""Administrator"" />
                      < xs:enumeration value = ""Editor"" />
                    </ xs:restriction >
                  </ xs:simpleType > ");

            // If MS-DWSS_R373 is verified correctly, it means this requirement can be verified.
            Site.CaptureRequirement(
                252,
                @"[In GetDwsMetaDataResponse] This element [Roles] MUST conform to the element specification in 2.2.3.6.");
            
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R620");

            // Verify MS-DWSS requirement: MS-DWSS_R620
            Site.CaptureRequirement(
                620,
                @"[In ListInfo] This element[ListInfo] is defined as follows:
                 <xs:element name=""ListInfo"">
                   < xs:complexType >
                     < xs:choice >
                       < xs:element ref= ""tns:Error"" minOccurs = ""0"" />
                       < xs:sequence >
                         < xs:element name = ""Moderated"" />
                          < s:simpleType >
                            < s:restriction base = ""s:string"" >
                            < s:enumeration value = ""True"" />
                            < s:enumeration value = ""False"" />
                            </ s:restriction >
                          </ s:simpleType >
                         </ xs:element >
                         < xs:element name = ""ListPermissions"" >
                           < xs:complexType >
                               < xs:sequence >
                                 < xs:element name = ""InsertListItems"" minOccurs = ""0"" />
                                 < xs:element name = ""EditListItems"" minOccurs = ""0"" />
                                 < xs:element name = ""DeleteListItems"" minOccurs = ""0"" />
                                 < xs:element name = ""ManageLists"" minOccurs = ""0"" />
                                 < xs:element ref= ""tns:Error"" minOccurs = ""0"" />
                               </ xs:sequence >
                           </ xs:complexType >
                         </ xs:element >
                       </ xs:sequence >
                     </ xs:choice >
                     < xs:attribute name = ""Name"" type = ""xs:string"" use = ""required"" />
                   </ xs:complexType >
                 </ xs:element > ");

            // If MS-DWSS_R620 is verified correctly, this requirements also can be verified directly.
            Site.CaptureRequirement(
                262,
                @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element Documents.");

            // If MS-DWSS_R620 is verified correctly, this requirements also can be verified directly.
            Site.CaptureRequirement(
                264,
                @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element specified in 3.1.4.8.2.3.");

            Results results = respResults.Results;

            if (results != null)
            {
                if (results.List != null)
                {
                    this.ValidateListElement(results.List);
                }

                if (results.List1 != null)
                {
                    this.ValidateListElement(results.List1);
                }

                if (results.List2 != null)
                {
                    this.ValidateListElement(results.List2);
                }
            }

            if (respResults.Schema != null)
            {
                // If the Schema is not null, it indicate that the server does return a Schema element as is specified.
                this.Site.CaptureRequirement(
                    861,
                    @"[In Schema] The Schema element is specified in [MS-PRSTFR] section 2.3.1.2. The following XML schema defines the Schema element:
                  <xs:element  name='Schema'>
                    <xs:complexType >
                      <xs:choice  minOccurs='0' maxOccurs='unbounded'>
                        <xs:element  name= 'AttributeType' type='xdr:AttributeType'/>
                        <xs:element  name= 'ElementType' type='xdr:ElementType'/>
                        <xs:element  ref='xdr:description'/>
                        <xs:any  namespace='##other' processContents='skip'/>
                      </xs:choice>
                      <xs:attribute  name='name' type='xs:string/>
                      <xs:attribute  name='id' type='xs:ID/>
                      <xs:anyAttribute  namespace='##other'
                                        processContents='skip'/>
                    </xs:complexType>
                  </xs:element>");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    862,
                    @"[In Schema] AttributeType: Specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    863,
                    @"[In Schema] ElementType: Specified in [MS-PRSTFR] section 2.3.1.2.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    864,
                    @"[In Schema] description: A description for the Schema element.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    865,
                    @"[In Schema] name: The name of the schema.");

                // If MS-DWSS_R861 is verified correctly, this requirement also can be verified directly.
                this.Site.CaptureRequirement(
                    866,
                    @"[In Schema] id: The identifier of the schema. Specified in [MS-PRSTFR] section 2.3.1.2.");

                bool isTasksSchemaContained = false;
                bool isDocumentsSchemaContained = false;
                bool isLinksSchemaContained = false;

                foreach (Schema schema in respResults.Schema)
                {
                    if (schema.Name == "Tasks")
                    {
                        isTasksSchemaContained = true;
                    }
                    else if (schema.Name == "Documents")
                    {
                        isDocumentsSchemaContained = true;
                    }
                    else if (schema.Name == "Links")
                    {
                        isLinksSchemaContained = true;
                    }
                }

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

                // Verify MS-DWSS requirement: MS-DWSS_R257
                Site.CaptureRequirementIfIsTrue(
                    isDocumentsSchemaContained,
                    257,
                    @"[In GetDwsMetaDataResponse] This element[Schema] MUST conform to the Schema element Documents.");

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

                // Verify MS-DWSS requirement: MS-DWSS_R258
                Site.CaptureRequirementIfIsTrue(
                    isLinksSchemaContained,
                    258,
                    @"[In GetDwsMetaDataResponse] This element[Schema] MUST conform to the Schema element Links.");

                if (isMinimal && Common.IsRequirementEnabled(2561, this.Site))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R2561");

                    // Verify MS-DWSS requirement: MS-DWSS_R2561
                    Site.CaptureRequirementIfIsFalse(
                        isTasksSchemaContained,
                        2561,
                        @"[In Appendix B: Product Behavior] Implementation does not return the Schema element for Tasks. (<9> Section 3.1.4.8.2.2: SharePoint Foundation 2013 does not return this Schema element.)");
                }

                if (this.IsListAdded && Common.IsRequirementEnabled(2562, this.Site))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R2562");

                    // Verify MS-DWSS requirement: MS-DWSS_R2562
                    Site.CaptureRequirementIfIsTrue(
                        isTasksSchemaContained,
                        2562,
                        @"[In Appendix B: Product Behavior] Implementation does return the Schema element for Tasks. (Windows SharePoint Services 3.0, SharePoint Foundation 2010, and Microsoft SharePoint Server 2016 and above follow this behavior.)");
                }
            }

            if (respResults.ListInfo != null)
            {
                bool isTasksListInfoContained = false;
                bool isDocumentListInfoContained = false;
                bool isLinksListInfoContained = false;

                foreach (ListInfo listInfo in respResults.ListInfo)
                {
                    if (listInfo.Name == "Tasks")
                    {
                        isTasksListInfoContained = true;
                    }
                    else if (listInfo.Name == "Documents")
                    {
                        isDocumentListInfoContained = true;
                    }
                    else if (listInfo.Name == "Links")
                    {
                        isLinksListInfoContained = true;
                    }
                }

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

                // Verify MS-DWSS requirement: MS-DWSS_R261
                Site.CaptureRequirementIfIsTrue(
                    isTasksListInfoContained,
                    261,
                    @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element Tasks.");

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

                // Verify MS-DWSS requirement: MS-DWSS_R262
                Site.CaptureRequirementIfIsTrue(
                    isDocumentListInfoContained,
                    262,
                    @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element Documents.");

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

                // Verify MS-DWSS requirement: MS-DWSS_R263
                Site.CaptureRequirementIfIsTrue(
                    isLinksListInfoContained,
                    263,
                    @"[In GetDwsMetaDataResponse] This element [ListInfo] MUST conform to the ListInfo element Links.");
            }
        }