/// <summary> /// Implement the GetItemsCount method for getting the count of the list items in the specified view. /// </summary> /// <param name="listGuid">A specified list GUID in the server.</param> /// <param name="viewGuid">A specified view GUID in the server.</param> /// <returns>The count of the list items in the specified view.</returns> public int GetItemsCount(string listGuid, string viewGuid) { int itemCount = 0; try { GetListItemsResponseGetListItemsResult getItemsResult = this.listProxy.GetListItems(listGuid, viewGuid, null, null, null, null, null); itemCount = getItemsResult.listitems.data.Any.Length; } catch (SoapException soapException) { this.Site.Log.Add( LogEntryKind.Debug, @"There is an exception generated when calling [GetItemsCount] method:\r\n{0}, check parameters are correct or not.", soapException.Message); throw; } return(itemCount); }
/// <summary> /// Verify the message syntax of GetListItems operation when the response is received /// successfully. /// </summary> /// <param name="getListItemResult">The result of the operation.</param> /// <param name="queryOptions">Specifies various options for modifying the query.</param> /// <param name="viewFields">Specifies which fields of the list item will be returned.</param> private void VerifyGetListItemsOperation(GetListItemsResponseGetListItemsResult getListItemResult, CamlQueryOptions queryOptions, CamlViewFields viewFields) { // Verify R1910 // 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( 1910, @"[The schema of GetListItems is defined as:]" + @"<wsdl:operation name=""GetListItems"">" + @" <wsdl:input message=""GetListItemsSoapIn"" />" + @" <wsdl:output message=""GetListItemsSoapOut"" />" + @"</wsdl:operation>"); // Verify R723 // 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( 723, @"[In GetListItems operation] [If the protocol client sends a GetListItemsSoapIn " + "request message] the protocol server responds with a GetListItemsSoapOut " + "response message."); // Verify R1918 // 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( 1918, @"[GetListItemsSoapOut]The SOAP Body contains a GetListItemsResponse " + "element."); // Verify R1935 // 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( 1935, @"[The schema of GetListItemsResponse is defined as:] " + @"<s:element name=""GetListItemsResponse"">" + @" <s:complexType mixed=""true"">" + @" <s:sequence>" + @" <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemsResult"">" + @" <s:complexType>" + @" <s:sequence>" + @" <s:element name=""listitems"" >" + @" <s:complexType mixed=""true"" >" + @" <s:sequence>" + @" <s:any />" + @" </s:sequence>" + @" </s:complexType>" + @" </s:element>" + @" </s:sequence>" + @" </s:complexType>" + @" </s:element>" + @" </s:sequence>" + @" </s:complexType>" + @"</s:element>"); // Verify R1936 // 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( 1936, @"[GetListItemsResponse]GetListItemsResult: This protocol server response included in " + "the listitems element is modeled on the Microsoft ADO 2.6 Persistence format " + "[MS-PRSTFR], excluding the <s:schema> element."); // Verify R2330 // 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( 2330, @"[In GetListitems operation] [In GetListitemsResponse element] [In GetListItemsResult " + "element]The listitems element includes attributes describing the namespaces " + "for the ADO 2.6 Persistence format."); // Verify R2331 // 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( 2331, @"[In GetListitems operation] [In GetListitemsResponse element] [In GetListItemsResult " + "element] [The listitems element] contains an inner element named rs:data, which is " + "of type DataDefinition."); // Verify R1938 // 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( 1938, @"[GetListItemsResponse]Note that set of fields returned by the method is restricted " + "by the viewField or viewName parameter."); // Verify R1940 // 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( 1940, @"[GetListItemsResponse]The listitems element contains attributes that define the " + "namespaces."); // Verify R1941 // 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( 1941, @"[GetListItemsResponse]Inside of this element[listitems] is the <rs:data> element, which " + "specifies how many rows of data are being returned, where a row of data " + "corresponds to a list item, and the paging token (if there are more rows in " + "the view than were returned)."); // Verify the requirements of the EnumViewAttributes simple type. if (queryOptions != null) { if (getListItemResult.listitems.data.Any != null) { DataTable data = AdapterHelper.ExtractData(getListItemResult.listitems.data.Any); string author = data.Columns.Contains("ows_Author") ? Convert.ToString(data.Rows[0]["ows_Author"]) : null; this.VerifyCamlQueryOptions(queryOptions, viewFields, author); } if (queryOptions.QueryOptions != null) { if (queryOptions.QueryOptions.ViewAttributes != null) { if (queryOptions.QueryOptions.ViewAttributes.ScopeSpecified) { this.VerifyEnumViewAttributes(); } } } } }