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

MSLISTSWS_S03_TC11_GetListItemChangesSinceToken_RowLimit() private method

        public void MSLISTSWS_S03_TC11_GetListItemChangesSinceToken_RowLimit()
        {
            string listId = TestSuiteHelper.CreateList();

            // Set the expected row limit number.
            int expectedRowLimit = 10;

            // Insert more rows than the expected row limit number, but not more than 40.
            TestSuiteHelper.AddListItems(listId, 20);

            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult result = null;

            // Call GetListItemChangesSinceToken with the specified row limit number.
            result = this.listswsAdapter.GetListItemChangesSinceToken(
                        listId,
                        null,
                        null,
                        null,
                        expectedRowLimit.ToString(),
                        null,
                        null,
                        null);

            if (null == result || null == result.listitems || null == result.listitems.data)
            {
                this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain any List item change.");
            }

            if (null == result.listitems.data.Any || 0 == result.listitems.data.Any.Length)
            {
                this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain valid change item.");
            }

            int actualListItemReturned = AdapterHelper.ExtractData(result.listitems.data.Any).Rows.Count;
            bool isRowLimitSpecifyMaxNumber = actualListItemReturned <= expectedRowLimit;

            this.Site.CaptureRequirementIfIsTrue(
                            isRowLimitSpecifyMaxNumber,
                            678,
                            "[In GetListItemChangesSinceToken operation] [In GetListItemChangesSinceToken element] [In rowLimit field] The protocol server MUST NOT return more inserted or updated list items than this parameter specifies.");

            if (Common.IsRequirementEnabled(2219, this.Site))
            {
                this.Site.CaptureRequirementIfIsTrue(
                            isRowLimitSpecifyMaxNumber,
                            2219,
                            "Implementation does specify rowLimit to indicate the maximum number of rows of data to return in the response. (The 2007 Microsoft® Office system/Windows® SharePoint® Services 3.0 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(677, this.Site))
            {
                // Call GetListItemChangesSinceToken without row limit number.
                result = this.listswsAdapter.GetListItemChangesSinceToken(
                            listId,
                            null,
                            null,
                            null,
                            null,
                            null,
                            null,
                            null);

                if (null == result || null == result.listitems || null == result.listitems.data)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain any List item change.");
                }

                if (null == result.listitems.data.Any || 0 == result.listitems.data.Any.Length)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain valid change item.");
                }

                actualListItemReturned = AdapterHelper.ExtractData(result.listitems.data.Any).Rows.Count;
                Site.Assert.AreEqual<int>(
                                20,
                                actualListItemReturned,
                                "If does not specify row limit, the response should contain all the rows.");

                // Call GetListItemChangesSinceToken without row limit number.
                result = this.listswsAdapter.GetListItemChangesSinceToken(
                            listId,
                            null,
                            null,
                            null,
                            "0",
                            null,
                            null,
                            null);

                if (null == result || null == result.listitems || null == result.listitems.data)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain any List item change.");
                }

                if (null == result.listitems.data.Any || 0 == result.listitems.data.Any.Length)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken operation does not contain valid change item.");
                }

                // If return all the rows in either unspecified row limit or "0" row limit,
                // capture R777.
                actualListItemReturned = AdapterHelper.ExtractData(result.listitems.data.Any).Rows.Count;
                this.Site.CaptureRequirementIfAreEqual<int>(
                                20,
                                actualListItemReturned,
                                677,
                                "[In GetListItemChangesSinceToken operation] [In GetListItemChangesSinceToken element] [In rowLimit field] Implementation does retrieve all rows when specifying a value of 0,unless the changeToken parameter is specified. (The 2007 Microsoft® Office system/Windows® SharePoint® Services 3.0 and above follow this behavior.)");
            }
        }
S03_OperationOnListItem