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

VerifyUpdateListItemsOperation() private method

Verify the message syntax of UpdateListItems operation when the response is received successfully.
private VerifyUpdateListItemsOperation ( UpdateListItemsResponseUpdateListItemsResult updateListItemsResult, UpdateListItemsUpdates updates ) : void
updateListItemsResult UpdateListItemsResponseUpdateListItemsResult The result of the operation.
updates UpdateListItemsUpdates The updates parameter of the method.
return void
        private void VerifyUpdateListItemsOperation(
            UpdateListItemsResponseUpdateListItemsResult updateListItemsResult,
            UpdateListItemsUpdates updates)
        {
            // Verify R2067
            // 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(
                2067,
                @"[The schema of UpdateListItems is defined as:]"
                + @"<wsdl:operation name=""UpdateListItems"">"
                + @"    <wsdl:input message=""UpdateListItemsSoapIn"" />"
                + @"    <wsdl:output message=""UpdateListItemsSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R905
            // 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(
                905,
                @"[In UpdateListItems operation] [If the protocol client sends an "
                + "UpdateListItemsSoapIn request message] the protocol server responds with an "
                + "UpdateListItemsSoapOut response message.");

            // Verify R2072
            // 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(
                2072,
                @"[UpdateListItemsSoapOut]The SOAP Body contains an UpdateListItemsResponse "
                + "element");

            // Verify R2111
            // 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(
                2111,
                @"[The schema of UpdateListItemsResponse is defined as:]  <s:element name=""UpdateListItemsResponse"">
                <s:complexType>
                  <s:sequence>
                    <s:element minOccurs=""0"" maxOccurs=""1"" name=""UpdateListItemsResult"">
                      <s:complexType mixed=""true"">
                        <s:sequence>
                          <s:element name=""Results"" >
                            <s:complexType>
                              <s:sequence>
                                <s:element name=""Result"" maxOccurs=""unbounded"">
                                  <s:complexType>
                                    <s:sequence>
                                      <s:element name=""ErrorCode"" type=""s:string"" />
                                              <s:any minOccurs=""0"" maxOccurs=""unbounded"" />
                                    </s:sequence>
                                  <s:attribute name=""ID"" type=""s:string"" />
                                <s:attribute name=""List"" type=""s:string""/>
                              <s:attribute name=""Version"" type=""s:string""/>
                            </s:complexType>
                          </s:element>
                        </s:sequence>
                      </s:complexType>
                    </s:element>
                  </s:sequence>
                </s:complexType>
              </s:element>
            </s:sequence>
          </s:complexType></s:element>");

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

            // If the first returned ID attribute is the Method ID, followed by a comma, 
            // followed by the Method operation, then the following requirements can be 
            // captured.
            for (int i = 0; i < updates.Batch.Method.Length; i++)
            {
                bool isVerifyR962 = false;
                bool isVerifyR923 = false;
                string[] strID = updateListItemsResult.Results[i].ID.Split(',');
                if (strID[0] == updates.Batch.Method[i].ID.ToString() && strID[1] == updates.Batch.Method[i].Cmd.ToString())
                {
                    isVerifyR962 = true;
                    isVerifyR923 = true;
                }

                // Verify R962
                Site.CaptureRequirementIfIsTrue(
                isVerifyR962,
                962,
                @"[In UpdateListItems operation] [In UpdateListItemsResponse element] [In "
                + "UpdateListItemsResult element] The ID attribute of the Method parameters "
                + "MUST correspond to the ID attribute of the Result element and the Result ID "
                + "is the Method ID, followed by a comma, followed by the Method operation.");

                // Verify R923
                Site.CaptureRequirementIfIsTrue(
                isVerifyR923,
                923,
                @"[In UpdateListItems operation] [In UpdateListItems element] [In updates "
                + "element] [In Method element] If the Method ID attribute is unique, the protocol "
                + "server MUST use the method identification to match up the request made to the "
                + "protocol server with the protocol server response.");
                //
                if ((updateListItemsResult.Results[i].ID == null || updateListItemsResult.Results[i].ID.ToString() == "") && (updateListItemsResult.Results[i].ErrorCode != ""))
                {
                Site.CaptureRequirement(
                    2323001,
                    @"An empty ID element following the ErrorCode element is included, which is reserved for future use. ");
                }
            }

            // Verify R2115
            // 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(
                2115,
                @"[UpdateListItemsResponse]The Result element MUST contain an ErrorCode element.");
        }
MS_LISTSWSAdapter