Microsoft.Protocols.TestSuites.MS_OUTSPS.S03_CheckListDefination.MSOUTSPS_S03_TC06_VerifyCHOICESAndMAPPINGSElements_TasksList C# (CSharp) Method

MSOUTSPS_S03_TC06_VerifyCHOICESAndMAPPINGSElements_TasksList() private method

        public void MSOUTSPS_S03_TC06_VerifyCHOICESAndMAPPINGSElements_TasksList()
        {
            // Add a Tasks list.
            string listId = this.AddListToSUT(TemplateType.Tasks);

            // Call GetList operation and get the "Priority" field.
            GetListResponseGetListResult getListResult = OutspsAdapter.GetList(listId);
            FieldDefinition fieldOfPriority = Common.GetFieldItemByName(getListResult, "Priority", this.Site);
            XmlElement rawResponsOfGetList = SchemaValidation.LastRawResponseXml;

            // Verify schema, if pass the schema validation for CHOICES and MAPPINGS elements, capture R774, R775, R778
            bool isPassTheSchemaValidation = this.VerifyChoicesAndMappingsSchema(rawResponsOfGetList, "Priority");

            this.Site.CaptureRequirementIfIsTrue(
                                                isPassTheSchemaValidation,
                                                774,
                                                @"[In Task-Specific Schema]Each MAPPINGS element holds a number and a string.");

            this.Site.CaptureRequirementIfIsTrue(
                                               isPassTheSchemaValidation,
                                               775,
                                               @"[In Task-Specific Schema][The schema definition of CHOICES is:]<s:element name=""CHOICES"" >
   < s:sequence >
      < s:element name = ""CHOICE"" type = ""string"" minOccurs = ""0"" maxOccurs = ""unbounded"" />
   </ s:sequence >
</ s:element > ");

            this.Site.CaptureRequirementIfIsTrue(
                                               isPassTheSchemaValidation,
                                               778,
                                               @"[In Task-Specific Schema][The schema definiton of MAPPINGS is:]<s:complexType name=""MAPPINGS"">
   <s:sequence>
      <s:element name=""MAPPING"" type=""string"" minOccurs=""0"" maxOccurs=""unbounded"">
         <s:complexType>
            <s:simpleContent>
               <s:extension base=""string"">
                  <s:attribute name=""Value"" type=""integer"" use=""required"" />
               </s:extension>
            </s:simpleContent>
         </s:complexType>
      </s:element>
   </s:sequence>
</s:complexType>");

            // Verify relationship between the CHOICES and MAPPINGS elements, each CHOICE item should be found a mapped item in MAPPINGS array.
            bool isMatchRelationShip = this.VerifyChoicesAndMappingsRelationShip(fieldOfPriority);

            // If pass the relationship validation, capture R77301, R779
            if (Common.IsRequirementEnabled(77301, this.Site))
            {
                // Verify MS-OUTSPS requirement: MS-OUTSPS_R77301
                this.Site.CaptureRequirementIfIsTrue(
                                                  isMatchRelationShip,
                                                  77301,
                                                  @"[In Task-Specific Schema]Implementation does provide a MAPPINGS element.(Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
            }

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R779
            this.Site.CaptureRequirementIfIsTrue(
                                               isMatchRelationShip,
                                               779,
                                               @"[In Task-Specific Schema]MAPPINGS.MAPPING and MAPPINGS.Value: If a string in a CHOICE element exactly matches a string in a MAPPING element, then the MAPPING.Value attribute associated with it can be used to represent the string.");

            // Call GetList operation and get the "Status" field.
            FieldDefinition fieldOfStatus = Common.GetFieldItemByName(getListResult, "Status", this.Site);

            isPassTheSchemaValidation = this.VerifyChoicesAndMappingsSchema(rawResponsOfGetList, "Status");
            this.Site.Assert.IsTrue(isPassTheSchemaValidation, "The MAPPINGS and CHOICES elements should match the schema definition.");
            
            isMatchRelationShip = this.VerifyChoicesAndMappingsRelationShip(fieldOfStatus);
            this.Site.Assert.IsTrue(isMatchRelationShip, "Each CHOICE item should be found a mapped item in MAPPINGS array");

            // If pass the relationship validation, and pass schema validation for CHOICES and MAPPINGS elements, capture R784
            this.Site.CaptureRequirement(
                                    784,
                                    @"[In Task-Specific Schema]This property[Status] works exactly the same way as the Priority task property also specified in this section (see section 3.2.4.2.8).");
        }