Microsoft.Protocols.TestSuites.MS_LISTSWS.S03_OperationOnListItem.MSLISTSWS_S03_TC55_GetListItems_WithPaging C# (CSharp) Method

MSLISTSWS_S03_TC55_GetListItems_WithPaging() private method

private MSLISTSWS_S03_TC55_GetListItems_WithPaging ( ) : void
return void
        public void MSLISTSWS_S03_TC55_GetListItems_WithPaging()
        {
            // Create a list.
            string listId = TestSuiteHelper.CreateList();

            // Insert 10 item.
            List<string> addedItems = TestSuiteHelper.AddListItems(listId, 10);

            // Sorted the list to make sure order by Ascending.
            addedItems = addedItems.OrderBy<string, int>(key => Convert.ToInt32(key)).ToList();

            // Create Query element to make the z:row ordered by OWS_ID Ascending.
            GetListItemsQuery query = new GetListItemsQuery();
            query.Query = new CamlQueryRoot();
            query.Query.OrderBy = new OrderByDefinition();
            query.Query.OrderBy.FieldRef = new FieldRefDefinitionOrderBy[1];
            query.Query.OrderBy.FieldRef[0] = new FieldRefDefinitionOrderBy();
            query.Query.OrderBy.FieldRef[0].Name = AdapterHelper.FieldIDName;
            query.Query.OrderBy.FieldRef[0].Ascending = "TRUE";

            // Set the row limit.
            string rowLimit = "2";

            // Call the GetListItems excluding the paging.
            GetListItemsResponseGetListItemsResult result = null;
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    rowLimit,
                                    null,
                                    null);

            // Call GetListItems with ListItemCollectionPositionNext which is got by previous call.
            CamlQueryOptions options = new CamlQueryOptions();
            options.QueryOptions = new CamlQueryOptionsQueryOptions();
            options.QueryOptions.Paging = new CamlQueryOptionsQueryOptionsPaging();
            options.QueryOptions.Paging.ListItemCollectionPositionNext = result.listitems.data.ListItemCollectionPositionNext;
            result = this.listswsAdapter.GetListItems(
                                    listId,
                                    null,
                                    query,
                                    null,
                                    null,
                                    options,
                                    null);

            string columnNameId = AdapterHelper.PrefixOws + AdapterHelper.FieldIDName;
            DataTable data = AdapterHelper.ExtractData(result.listitems.data.Any);

            // If the returned first z:row ows_ID equals the next page's first addedItems element, 
            // Then capture requirement R1252.
            bool isNextPage = Convert.ToString(data.Rows[0][columnNameId]) == addedItems[Convert.ToInt32(rowLimit)];
            Site.CaptureRequirementIfIsTrue(
                isNextPage,
                1252,
                @"[Paging]The protocol server MUST return the next page of data based on the "
                + "bookmark supplied.");
        }
S03_OperationOnListItem