/// <remarks/>
 public void GetListItemChangesWithKnowledgeAsync(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains, object userState)
 {
     if ((this.GetListItemChangesWithKnowledgeOperationCompleted == null))
     {
         this.GetListItemChangesWithKnowledgeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetListItemChangesWithKnowledgeOperationCompleted);
     }
     this.InvokeAsync("GetListItemChangesWithKnowledge", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             syncScope,
             knowledge,
             contains}, this.GetListItemChangesWithKnowledgeOperationCompleted, userState);
 }
        public void MSOUTSPS_S02_TC52_OperateOnListItems_VerifyMoreChangeValue()
        {
            string listId = this.AddListToSUT(TemplateType.Generic_List);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Call GetListItemChangesSinceToken operation to get a token.
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                          listId,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null);

                if (null == listItemChangesRes || null == listItemChangesRes.listitems || null == listItemChangesRes.listitems.Changes)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken should contain the valid the changes data.");
                }

                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(listItemChangesRes.listitems.Changes.LastChangeToken),
                                "The response of GetListItemChangesSinceToken should contain valid ChangeToken.");

                string changeTokenValue = listItemChangesRes.listitems.Changes.LastChangeToken;

                // Add 10 list items.
                this.AddItemsToList(listId, 10);

                // Setting "<viewFields />" to view all fields of the list.
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                // Set the low limited value equal to 2, apply the change token in the request, in order to the actual response contain more change flag.
                int rowLimitedValue = 2;
                listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId,
                                            null,
                                            null,
                                            viewfieds,
                                            rowLimitedValue.ToString(),
                                            null,
                                            changeTokenValue,
                                            null);

                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);

                this.Site.Assert.AreEqual<int>(
                                            rowLimitedValue,
                                            zrowItems.Length,
                                            "The return zrow item should match the specified row limit value.");

                if (null == listItemChangesRes || null == listItemChangesRes.listitems || null == listItemChangesRes.listitems.Changes)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken should contain the valid the changes data.");
                }

                // If the MoreChanges present and its value equal to TRUE, then capture R1225.
                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(listItemChangesRes.listitems.Changes.MoreChanges),
                                "The response of GetListItemChangesSinceToken should contain MoreChanges value.");

                string moreChangesValue = listItemChangesRes.listitems.Changes.MoreChanges;
                this.Site.Assert.IsTrue(
                                  moreChangesValue.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase),
                                  "The MoreChanges value should equal to 'TRUE'.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R1225
                this.Site.CaptureRequirement(
                                    1225,
                                    @"[In GetListItemChangesSinceTokenResponse][If present condition meet][The attribute]Changes.MoreChanges is contained within GetListItemChangesSinceTokenResponse.GetListItemChangesSinceTokenResult.listitems, as specified by [MS-LISTSWS].");
            }
        }
        /// <summary>
        /// The GetListItemChanges operation is used to retrieve the list items that have been inserted or updated 
        /// since the specified date and time and matching the specified filter criteria.
        /// </summary>
        /// <param name="listName">The name of the list from which the list item changes will be got</param>
        /// <param name="viewFields">Indicates which fields of the list item SHOULD be returned</param>
        /// <param name="since">The date and time to start retrieving changes in the list
        /// If the parameter is null, Protocol Server should return all list items
        /// If the date that is passed in is not in UTC format, protocol server will use protocol server's local time zone and converted to UTC time</param>
        /// <param name="contains">Restricts the results returned by giving a specific value to be searched for in the specified list item field</param>
        /// <returns>Return the get list item change result</returns>
        public GetListItemChangesResponseGetListItemChangesResult GetListItemChanges(string listName, CamlViewFields viewFields, string since, CamlContains contains)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            GetListItemChangesResponseGetListItemChangesResult result = null;
            try
            {
                result = this.listsProxy.GetListItemChanges(listName, viewFields, since, contains);

                // Verify the requirements of GetListItemChanges operation.
                this.VerifyGetListItemChangesOperation(result);
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }
            
            return result;
        }
        public void MSOUTSPS_S02_TC46_OperateOnListItems_VerifyContentTypeId()
        {
            // Add a list and add a list item into the list.
            string listIdOfAppointment = this.AddListToSUT(TemplateType.Events);
            List<string> listitemIdsOfAppointment = this.AddItemsToList(listIdOfAppointment, 1);

            // If the content id begin with expected value, then capture R185
            bool isVerifyR185 = this.VerifyContentTypeIdForSpecifiedList(listIdOfAppointment, listitemIdsOfAppointment[0], "0x0102");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R185
            this.Site.CaptureRequirementIfIsTrue(
                                  isVerifyR185,
                                  185,
                                  @"[In Common Schema]ContentTypeId begins with 0x0102 corresponds to Appointment Content / item type name.");

            // Add a list and add a list item into the list.
            string listIdOfContacts = this.AddListToSUT(TemplateType.Contacts);
            List<string> listitemIdsOfContacts = this.AddItemsToList(listIdOfContacts, 1);

            // If the content id begin with expected value, then capture R186
            bool isVerifyR186 = this.VerifyContentTypeIdForSpecifiedList(listIdOfContacts, listitemIdsOfContacts[0], "0x0106");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R186
            this.Site.CaptureRequirementIfIsTrue(
                                  isVerifyR186,
                                  186,
                                  @"[In Common Schema]ContentTypeId begins with 0x0106 corresponds to Contact Content / item type name.");

            // Add a list and add a list item into the list.
            string documentLibraryTitle = this.GetUniqueListName(TemplateType.Document_Library.ToString());
            string listIdOfDocLibrary = this.AddListToSUT(documentLibraryTitle, TemplateType.Document_Library);
            string fileNameOnSut = this.GetUniqueUploadFileName();
            string uploadFilePath = SutControlAdapter.AddOneFileToDocumentLibrary(documentLibraryTitle, fileNameOnSut);
            this.Site.Assert.IsFalse(
                            string.IsNullOrEmpty(uploadFilePath),
                            "The uploading file to list[{0}] process should be succeed. Expected file name:[{1}]",
                             documentLibraryTitle,
                             fileNameOnSut);

            // Current document library only have one uploaded file, so the list item id is 1.  
            bool isVerifyR189 = this.VerifyContentTypeIdForSpecifiedList(listIdOfDocLibrary, "1", "0x0101");

            // If the content id begin with expected value, then verify MS-OUTSPS requirement: MS-OUTSPS_R189
            this.Site.CaptureRequirementIfIsTrue(
                                  isVerifyR189,
                                  189,
                                  @"[In Common Schema]ContentTypeId begins with 0x0101 corresponds to Document Content / item type name.");

            // Add a folder into the document library.
            string folderName = this.GetUniqueFolderName();
            string listItemIdOfFolder = this.AddFolderIntoList(listIdOfDocLibrary, folderName);

            // The folder item could only get by GetListItemChangesSinceToken operation.
            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesResOfSinceToken = OutspsAdapter.GetListItemChangesSinceToken(
                                                        listIdOfDocLibrary,
                                                        null,
                                                        null,
                                                        viewfieds,
                                                        null,
                                                        null,
                                                        null,
                                                        null);

                this.VerifyContainZrowDataStructure(listItemChangesResOfSinceToken);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesResOfSinceToken.listitems.data.Any);
                int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, listItemIdOfFolder);
                string contentTypeId = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_ContentTypeId");

                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(contentTypeId),
                                @"The contentTypeId field should have value.");

                // If the ContentTypeId field value begin with 0x0120, then capture R190
                bool isBeginWithExpectedValue = contentTypeId.StartsWith("0x0120", StringComparison.OrdinalIgnoreCase);
                this.Site.Assert.IsTrue(
                                      isBeginWithExpectedValue,
                                      "The contentTypeId should begin with:[{0}], the actual value:[{1}]",
                                      "0x0120",
                                      contentTypeId);

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R190
                this.Site.CaptureRequirement(
                                      190,
                                      @"[In Common Schema]ContentTypeId begins with 0x0120 corresponds to Folder Content / item type name.");
            }

            // Add a list and add a list item into the list.
            string listIdOfTasks = this.AddListToSUT(TemplateType.Tasks);
            this.AddItemsToList(listIdOfTasks, 1);

            // If the content id begin with expected value, then capture R186
            bool isVerifyR191 = this.VerifyContentTypeIdForSpecifiedList(listIdOfTasks, listitemIdsOfContacts[0], "0x0108");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R191
            this.Site.CaptureRequirementIfIsTrue(
                                  isVerifyR191,
                                  191,
                                  @"[In Common Schema]ContentTypeId Begins With 0x0108 corresponds to Task Content / item type name.");
        }
        public void MSOUTSPS_S02_TC49_OperationListItemsForDiscussion()
        {
            string listId = this.AddListToSUT(TemplateType.Discussion_Board);

            byte[] messageDataOfFirstItem = this.GetMessageDataForAddDiscussionBoardItem();
            OutspsAdapter.AddDiscussionBoardItem(listId, messageDataOfFirstItem);

            // add other DiscussionBoard item. 
            byte[] messageDataOfSecondItem = this.GetMessageDataForAddDiscussionBoardItem();
            OutspsAdapter.AddDiscussionBoardItem(listId, messageDataOfSecondItem);

            Dictionary<string, string> fieldsValueSettings = new Dictionary<string, string>();

            fieldsValueSettings.Add("Body", this.GenerateRandomString(10));

            fieldsValueSettings.Add("Title", this.GenerateRandomString(10));

            // Setting the fields setting to update the added discussion board item.
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.Update);

            // Current test suite have two items, now only update the first item.
            fieldsValueSettings.Add("ID", "1");

            // Setting recurring setting
            List<Dictionary<string, string>> updateditemsOfDiscussionBoard = new List<Dictionary<string, string>>();
            updateditemsOfDiscussionBoard.Add(fieldsValueSettings);

            // Update the discussion board item into the list.
            UpdateListItemsUpdates updatesOfDiscussionBoardItem = this.CreateUpdateListItems(cmds, updateditemsOfDiscussionBoard, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfDiscussionBoardItem);

            // Get list item id from the response of UpdateListItems operation.
            this.VerifyResponseOfUpdateListItem(updateResult);
            List<string> updatedDiscussionBoardItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                                        listId,
                                                        null,
                                                        null,
                                                        viewfieds,
                                                        null,
                                                        null,
                                                        null,
                                                        null);

                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);
                int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, updatedDiscussionBoardItemIds[0]);

                string contentTypeId = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_ContentTypeId");
                string id = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_ID");
                string hiddenversion = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_owshiddenversion");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R208
                this.Site.CaptureRequirementIfIsTrue(
                    !string.IsNullOrEmpty(contentTypeId) && !string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(hiddenversion),
                    208,
                    "[In Common Schema]Unless stated otherwise[Attachments, Categories, Created, Modified, ReplicationID, vti_versionhistory], all fields in this section[ContentTypeId, ID, owshiddenversion] MUST be present on all item types<20> and contain valid data.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R188
                this.Site.CaptureRequirementIfIsTrue(
                    contentTypeId.StartsWith("0x012002", StringComparison.CurrentCultureIgnoreCase),
                    188,
                    "[In Common Schema]ContentTypeId begins with 0x012002 corresponds to Discussion item Content / item type name.");

                // Ignore the fieldsValueSettings
                string bodyValueInSetting = fieldsValueSettings["Body"];
                fieldsValueSettings.Remove("Body");
                this.VerifyFieldsValuesEqualToExpected(fieldsValueSettings, zrowItems[zrowIndex]);

                string bodyValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_Body");
                this.Site.Assert.IsTrue(
                                       bodyValue.IndexOf(bodyValueInSetting, StringComparison.OrdinalIgnoreCase) >= 0,
                                       @"The Body field's actual value[{0}] should contain the sub string[{1}].",
                                       bodyValue,
                                       bodyValueInSetting);

                string currentUserValue = this.GetUserTypeValue();
                string editorValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_Editor");
                this.VerifyUserType(editorValue, currentUserValue, "Editor");

                string authorValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_Author");
                this.VerifyUserType(authorValue, currentUserValue, "Author");

                // Current list have only two items.
                this.Site.Assert.AreEqual<int>(
                                     2,
                                     zrowItems.Length,
                                     "The current list identified by list id[{0}] should contain two items.",
                                     listId);

                string actualThreadIndexValueOfFirstItem = Common.GetZrowAttributeValue(zrowItems, 0, "ows_ThreadIndex");
                string actualThreadIndexValueOfSecondItem = Common.GetZrowAttributeValue(zrowItems, 1, "ows_ThreadIndex");

                // If the ThreadIndex values are different between the first item and the second item, then capture R720.
                // Verify MS-OUTSPS requirement: MS-OUTSPS_R720
                this.Site.CaptureRequirementIfAreNotEqual<string>(
                                        actualThreadIndexValueOfFirstItem.ToLower(),
                                        actualThreadIndexValueOfSecondItem.ToLower(),
                                        720,
                                        @"[In Discussion-Specific Schema]ThreadIndex: A thread index string that uniquely identifies each discussion thread in a list.");
            }
        }
        public void MSOUTSPS_S02_TC38_GetListItemChangesSinceToken_Support()
        {
            // Add a list and add one item.
            string listId = this.AddListToSUT(TemplateType.Generic_List);
            List<string> listItemsIds = this.AddItemsToList(listId, 1);

            // Setting "<viewFields />" to view all fields of the list.
            CamlViewFields viewfieds = new CamlViewFields();
            viewfieds.ViewFields = new CamlViewFieldsViewFields();

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Call GetListItemChangesSinceToken operation to get items' change.
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId,
                                            null,
                                            null,
                                            viewfieds,
                                            null,
                                            null,
                                            null,
                                            null);

                // Get the list items change data.
                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);

                // If the zrow index can be get and no Assert exception is thrown by GetZrowItemIndexByListItemId method, that means the added item id is present in response of GetListItemChangesSinceToken operation, then capture R12552, R106802, R12160
                this.GetZrowItemIndexByListItemId(zrowItems, listItemsIds[0]);

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R106802
                this.Site.CaptureRequirement(
                                    106802,
                                    @"[In Appendix B: Product Behavior] Implementation does support GetListItemChangesSinceToke.(Microsoft® Office Outlook® 2003 and Windows SharePoint Services 3.0 and above follow this behavior)");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R12160
                this.Site.CaptureRequirement(
                                    12160,
                                    @"[In Messages]GetListItemChangesSinceTokenResponse specified the response to a request to download changes that have happened since the protocol client's last download on any protocol server that supports it.");

                if (Common.IsRequirementEnabled(12552, this.Site))
                {
                    #region Get protocol SUT version and verify it

                    GetListResponseGetListResult getListResult = OutspsAdapter.GetList(listId);
                    if (null == getListResult || null == getListResult.List)
                    {
                        this.Site.Assert.Fail("The response of GetList operation should contain valid List element.");
                    }

                    string sutVersion = getListResult.List.ServerSettings.ServerVersion;
                    this.Site.Assert.IsFalse(
                                        string.IsNullOrEmpty(sutVersion),
                                        "The ServerVersion element should have value.");

                    bool isCurrentVersionEqualOrLargerThanSpecfied = VerifyEqualOrLargerThanSpecifiedVersionString(sutVersion, "12.0.0.4326");

                    #endregion Get protocol SUT version and verify it

                    // If the server version value is equal or larger than "12.0.0.4326" and the protocol SUT support the GetListItemChangesSinceToken operation, then capture R12552.
                    this.Site.Assert.IsTrue(
                                        isCurrentVersionEqualOrLargerThanSpecfied,
                                        "The server version should be equal or larger than [12.0.0.4326], that indicate the protocol SUT support the GetListItemChangesSinceToken operation.");

                    // Verify MS-OUTSPS requirement: MS-OUTSPS_R12552
                    this.Site.CaptureRequirement(
                                        12552,
                                        @"[In Appendix B: Product Behavior][<2> Section 3.1.4: ]A value of ""12.0.0.4326"" or greater indicates the server supports GetListItemChangesSinceToken.");
                }
            }

            // Call GetListItemChanges operation to get items' change.
            GetListItemChangesResponseGetListItemChangesResult responseOfGetListItemChanges = null;
            responseOfGetListItemChanges = OutspsAdapter.GetListItemChanges(
                                                                        listId,
                                                                        viewfieds,
                                                                        null,
                                                                        null);

            this.Site.Assert.IsNotNull(
                                    responseOfGetListItemChanges,
                                    "The response of GetListItemChangesSinceToken operation should have value.");
            this.Site.Assert.IsNotNull(
                         responseOfGetListItemChanges.listitems.data,
                         "The response of GetListItemChangesSinceToken operation should contain [zrow] data structure under [listitems] element.");

            XmlNode[] zrowItemsOfGetListItemChanges = this.GetZrowItems(responseOfGetListItemChanges.listitems.data[0].Any);

            // If the zrow index can be get and no Assert exception is thrown by GetZrowItemIndexByListItemId method, that means the added item id is present in response of GetListItemChangesSinceToken operation.
            this.GetZrowItemIndexByListItemId(zrowItemsOfGetListItemChanges, listItemsIds[0]);
        }
        public void MSOUTSPS_S02_TC43_DeleteDocumentsAndFolders()
        {
            this.Site.Assume.IsTrue(
                        Common.IsRequirementEnabled(106802, this.Site),
                        "Test is executed only when R106802Enabled is set to true.");

            // Add document library
            string listTitle = this.GetUniqueListName(TemplateType.Document_Library.ToString());
            string listId = this.AddListToSUT(listTitle, TemplateType.Document_Library);

            // Add a folder item into this document library.
            string folderName = this.GetUniqueFolderName();
            this.AddFolderIntoList(listId, folderName);

            // Upload a file into this folder
            string uploadFileName = this.GetUniqueUploadFileName();
            string fileUrl = SutControlAdapter.UploadFileWithFolder(listTitle, folderName, uploadFileName);
            this.Site.Assert.IsFalse(
                            string.IsNullOrEmpty(fileUrl),
                            "Uploading file to folder[{0}] under list[{1}] should succeed.",
                            folderName,
                            listTitle);

            // Call the GetListItemChangesSinceToken to get the added two items.
            // Set "<ViewFields />" in order to show all fields' value of a list.
            CamlViewFields viewfieds = new CamlViewFields();
            viewfieds.ViewFields = new CamlViewFieldsViewFields();

            // Call GetListItemChanges operation to get list items change.
            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
            listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                        listId,
                                        null,
                                        null,
                                        viewfieds,
                                        null,
                                        null,
                                        null,
                                        null);

            // Get the list items change data.
            this.VerifyContainZrowDataStructure(listItemChangesRes);
            XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);
            this.Site.Assert.IsNotNull(listItemChangesRes.listitems.Changes, "The Changes element should have value.");
            string tokenValue = listItemChangesRes.listitems.Changes.LastChangeToken;
            this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(tokenValue),
                                "The LastChangeToken should have value.");

            this.Site.Assert.AreEqual<int>(
                            2,
                            zrowItems.Count(),
                            "The response of GetListItemChangesSinceToken operation should contain two list items' change record.");

            // Verify these two item are contain in the response of GetListItemChangesSinceToken. If there are no any match zrow items found in zrow items array, the GetZrowItemIndexByFileRef method will throw Assert exception.
            this.GetZrowItemIndexByFileRef(zrowItems, folderName);
            int index =  this.GetZrowItemIndexByFileRef(zrowItems, uploadFileName);

            string fileName = Common.GetZrowAttributeValue(zrowItems, index, "ows_LinkFilename");
            string fileSize = Common.GetZrowAttributeValue(zrowItems, index, "ows_FileSizeDisplay");
            string fileAbsUrl = Common.GetZrowAttributeValue(zrowItems, index, "ows_EncodedAbsUrl");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R63
            this.Site.CaptureRequirementIfIsTrue(
                !string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileSize) && !string.IsNullOrEmpty(fileAbsUrl),
                63,
                @"[In Documents]The document item MUST include information for the file name, size, and how or where to get the file itself.");

            // Delete the folder item.
            bool deleteFolderResult = SutControlAdapter.DeleteFolder(listTitle, folderName);
            this.Site.Assert.IsTrue(
                        deleteFolderResult,
                        "Delete the folder[{0}] should succeed.",
                        folderName);

            listItemChangesRes = null;
            listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                        listId,
                                        null,
                                        null,
                                        viewfieds,
                                        null,
                                        null,
                                        tokenValue,
                                        null);

            // Get the list items change data after delete folder.
            this.VerifyContainZrowDataStructure(listItemChangesRes);
            this.Site.Assert.AreEqual<string>(
                "0",
                listItemChangesRes.listitems.data.ItemCount,
                "There should be no any list items return from protocol SUT after deleting the folder.");

            // Call HTTPGET method to try to get the upload file.
            HttpStatusCode statusCode = HttpStatusCode.OK;
            Uri fullUrlOfAttachmentPath;
            if (!Uri.TryCreate(fileUrl, UriKind.RelativeOrAbsolute, out fullUrlOfAttachmentPath))
            {
                this.Site.Assert.Fail("The full url of attachment should be valid Uri format string.");
            }

            try
            {
                OutspsAdapter.HTTPGET(fullUrlOfAttachmentPath, "f");
            }
            catch (WebException webEx)
            {
                statusCode = this.GetStatusCodeFromWebException(webEx);
            }

            // If the HTTPGET method return 404 NotFound exception, that means the upload file are deleted when deleted the folder.
            // Verify MS-OUTSPS requirement: MS-OUTSPS_R66
            this.Site.CaptureRequirementIfAreEqual<HttpStatusCode>(
                                HttpStatusCode.NotFound,
                                statusCode,
                                66,
                                @"[In Documents]If the folder item is deleted, then all documents and folders in it MUST be deleted too.");
        }
        /// <summary>
        /// A method used to get list items changes from protocol SUT, it will use "GetListItemChangesSinceToken" operation as the first choice. If the protocol SUT does not support the "GetListItemChangesSinceToken" operation, this method will use "GetListItemChanges" operation. Support GetListItemChangesSinceToken" operation is determined by "R106802Enabled" property on product option behaviors configuration file. This method will set "EnumRecurrencePatternXMLVersion.v3" in request, so that it could receive recurrence XML for certain types of recurrences appointment items.
        /// </summary>
        /// <param name="listId">A parameter represents the id of the list, which contain list items' changes.</param>
        /// <param name="viewfieds">A parameter represents the CamlViewFields instance which will be set into the request of SOAP operation, if this value is null, this method will set a "ViewFields" element in request of SOAP operation.</param>
        /// <returns>A return value presents the list items' changes data. each item mapping a list item's data on protocol SUT. If there are no any list items in the list, method will return a zero length zrow item array.</returns>
        protected XmlNode[] TryGetListItemsChangesFromSUT(string listId, CamlViewFields viewfieds)
        {
            if (string.IsNullOrEmpty(listId))
            {
                throw new ArgumentNullException("listId");
            }

            XmlNode[] listItemsChanges = null;

            // Set "<ViewFields />" in order to show all fields' value of a list, if the viewfieds parameter does not have value.
            if (null == viewfieds)
            {
                viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();
            }

            // If the protocol SUT support GetListItemChangesSinceToken changes, this method will use this GetListItemChangesSinceToken operation to get the list items' changes.
            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesResOfSinceToken = OutspsAdapter.GetListItemChangesSinceToken(
                                                        listId,
                                                        null,
                                                        null,
                                                        viewfieds,
                                                        null,
                                                        null,
                                                        null,
                                                        null);

                this.VerifyContainZrowDataStructure(listItemChangesResOfSinceToken);
                listItemsChanges = this.TryGetZrowItems(listItemChangesResOfSinceToken.listitems.data.Any);
                this.Site.Log.Add(LogEntryKind.Debug, "Get the list items' changes by using GetListItemChangesSinceToken operation.");
            }
            else
            {
                // Call GetListItemChanges operation to get list items change.
                GetListItemChangesResponseGetListItemChangesResult listitemChangesRes = null;
                listitemChangesRes = OutspsAdapter.GetListItemChanges(
                                         listId,
                                         viewfieds,
                                         null,
                                         null);

                // Get the list items change data.
                this.VerifyContainZrowDataStructure(listitemChangesRes);
                listItemsChanges = this.TryGetZrowItems(listitemChangesRes.listitems.data[0].Any);
                this.Site.Log.Add(LogEntryKind.Debug, "Get the list items' changes by using GetListItemChanges operation.");
            }

            return listItemsChanges;
        }
        /// <summary>
        /// Verify the requirements of the complex type CamlQueryOptions.
        /// </summary>
        /// <param name="query">The actual CamlQueryOptions.</param>
        /// <param name="viewFields">Specifies which fields of the list item should be returned</param>
        /// <param name="returnedAuthorField">The actual returned Author field.</param>
        private void VerifyCamlQueryOptions(
            CamlQueryOptions query,
            CamlViewFields viewFields,
            string returnedAuthorField)
        {
            Site.Assert.IsNotNull(query, "The CamlQueryOptions cannot be null");

            // Verify R34
            bool authorContained = false;
            if (viewFields != null)
            {
                if (viewFields.ViewFields != null)
                {
                    if (viewFields.ViewFields.FieldRef != null)
                    {
                        foreach (CamlViewFieldsViewFieldsFieldRef fr in viewFields.ViewFields.FieldRef)
                        {
                            if (string.Compare(fr.Name, AdapterHelper.FieldAuthorName, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                authorContained = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(query.QueryOptions.ExpandUserField))
            {
                if (bool.Parse(query.QueryOptions.ExpandUserField) && authorContained)
                {
                    // Verify MS-LISTSWS requirement: MS-LISTSWS_R34
                    // If the returned Author field contains ",#", which means "Name", 
                    // "EMail", "SipAddress", and "Title" fields from the user information List are 
                    // returned, then the requirement can be captured.
                    bool isVerifyR34 = false;
                    if (!string.IsNullOrEmpty(returnedAuthorField))
                    {
                        isVerifyR34 = returnedAuthorField.Contains(",#");
                    }

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR34,
                        34,
                        @"[In CAMLQueryOptions] [ExpandUserField] If set to True, specifies that fields "
                        + "in list items that are lookup fields to the user information list are returned as "
                        + @"if they were multi-value lookups, including ""Name"", ""EMail"", "
                        + @"""SipAddress"", and ""Title"" fields from the user information List for the "
                        + "looked-up item.");
                }
            }
        }
 /// <remarks/>
 public void GetListItemChangesSinceTokenAsync(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains, object userState)
 {
     if ((this.GetListItemChangesSinceTokenOperationCompleted == null))
     {
         this.GetListItemChangesSinceTokenOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetListItemChangesSinceTokenOperationCompleted);
     }
     this.InvokeAsync("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains}, this.GetListItemChangesSinceTokenOperationCompleted, userState);
 }
        /// <summary>
        /// A method used to get list items changes from protocol SUT, it will use "GetListItemChangesSinceToken" operation as the first choice. If the protocol SUT does not support the "GetListItemChangesSinceToken" operation, this method will use "GetListItemChanges" operation. Support GetListItemChangesSinceToken" operation is determined by "R106802Enabled" property on product option behaviors configuration file. This method will set "EnumRecurrencePatternXMLVersion.v3" in request, so that it could receive recurrence XML for certain types of recurrences appointment items. If there are no any list items get by this method, it will throw Assert exception.
        /// </summary>
        /// <param name="listId">A parameter represents the id of the list, which contain list items' changes.</param>
        /// <param name="viewfieds">A parameter represents the CamlViewFields instance which will be set into the request of SOAP operation, if this value is null, this method will set a "ViewFields" element in request of SOAP operation.</param>
        /// <returns>A return value presents the list items' changes data. each item mapping a list item's data on protocol SUT.</returns>
        protected XmlNode[] GetListItemsChangesFromSUT(string listId, CamlViewFields viewfieds)
        {
            if (string.IsNullOrEmpty(listId))
            {
                throw new ArgumentNullException("listId");
            }

            XmlNode[] listItemsChanges = this.TryGetListItemsChangesFromSUT(listId, viewfieds);

            // If there are no any list items return, throw assert exception.
            this.Site.Assert.AreNotEqual<int>(
                                   0,
                       listItemsChanges.Length,
                       "The list identified by list id[{0}] should contain at least one list items.",
                       listId);

            return listItemsChanges;
        }
 /// <remarks/>
 public void GetListItemChangesSinceTokenAsync(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
 {
     this.GetListItemChangesSinceTokenAsync(listName, viewName, query, viewFields, rowLimit, queryOptions, changeToken, contains, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginGetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains}, callback, asyncState);
 }
 public GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult GetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
 {
     object[] results = this.Invoke("GetListItemChangesSinceToken", new object[] {
             listName,
             viewName,
             query,
             viewFields,
             rowLimit,
             queryOptions,
             changeToken,
             contains});
     return ((GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult)(results[0]));
 }
        public void MSOUTSPS_S02_TC02_OperationListItems_fAllDayEvent()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = new DateTime(DateTime.Today.Date.Year, DateTime.Today.Date.Month, DateTime.Today.Date.Day);

            // If fAllDayEvent equal to 1 and the endDate is in same nature day, the end date is equal to 2009-05-19T23:59:59Z
            DateTime endDate = new DateTime(eventDate.Year, eventDate.Month, eventDate.Day, 23, 59, 59);

            // If fAllDayEvent equal to 1, then the eventdate field must be 0 hours UTC as in this example: "2009-05-19T00:00:00Z".
            string timeFormatPattern = @"yyyy-MM-ddT00:00:00Z";
            string eventDateValue = eventDate.ToString(timeFormatPattern);
            string endDateValue = endDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
            string eventTitle = this.GetUniqueListItemTitle("AllDayEvent");

            recurEventFieldsSetting.Add("Title", eventTitle);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // "0" means a single instance.
            recurEventFieldsSetting.Add("EventType", "0");

            // "0" means this is not an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "1");

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            this.VerifyResponseOfUpdateListItem(updateResult);

            // Set "<ViewFields />" in order to show all fields' value of a list.
            CamlViewFields viewfieds = new CamlViewFields();
            viewfieds.ViewFields = new CamlViewFieldsViewFields();

            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");
            string actualEventDateValue = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventDate");
            string actualEndDateValue = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EndDate");
            #region Capture code

            string duration = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_Duration");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R863
            this.Site.CaptureRequirementIfAreEqual<string>(
                "86340",
                duration,
                863,
                @"[In Appointment-Specific Schema]If the fAllDayEvent property is 1, the Duration MUST be 86340 seconds (1 minute less than 24 hours) when the appointment is not a single appointment. ");

            DateTime actualEndDate;
            if (!DateTime.TryParse(actualEndDateValue, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out actualEndDate))
            {
                this.Site.Assert.Fail("The EndDate field value should be a valid DateTime format.");
            }

            DateTime actualEventDate;
            if (!DateTime.TryParse(actualEventDateValue, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out actualEventDate))
            {
                this.Site.Assert.Fail("The EventDate field value should be a valid DateTime format.");
            }

            this.Site.Assert.AreEqual<DateTime>(
                               eventDate,
                               actualEventDate,
                               "The EventDate value should equal to the value set in the request of UpdateListItems.");

            // If the EventDate fields' values equal to the values the client set in upon steps and EventDate field in response follow the format "XXXX-XX-XXT00:00:00Z" then capture R862
            this.Site.Assert.AreEqual<int>(
                                        0,
                                        eventDate.Hour,
                                        "The EventDate field of an AllDayEvent type appointment should be a zero hours UTC format.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R862
            this.Site.CaptureRequirement(
                                862,
                                @"[In Appointment-Specific Schema]If the fAllDayEvent property is 1 then the time portion of the EventDate MUST be 0 hours UTC as in this example: ""2009-05-19T00:00:00Z"".");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R300
            this.Site.CaptureRequirementIfAreEqual(
                "0",
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventType"),
                300,
                "[In Appointment-Specific Schema]If the EventType is something else[0], then RecurrenceID can be empty or missing.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1008
            this.Site.CaptureRequirementIfAreEqual(
                "0",
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventType"),
                1008,
                "[In EventType][The enumeration value]0[of the type EventType means]Single instance.");

            #endregion
        }
        /// <summary>
        /// Verify the message syntax of GetListItemChangesSinceToken operation when the response 
        /// is received successfully.
        /// </summary>
        /// <param name="getListItemChangesSinceTokenResult">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 VerifyGetListItemChangesSinceTokenOperation(
            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult getListItemChangesSinceTokenResult,
            CamlQueryOptions queryOptions,
            CamlViewFields viewFields)
        {
            // Ensure the SOAP result is de-serialized successfully.
            Site.Assume.IsNotNull(getListItemChangesSinceTokenResult, "The result of GetListItemChangesSinceToken operation must not be null.");

            // Verify R1876
            // 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(
                1876,
                @"[The schema of GetListItemChangesSinceToken is defined as:]"
                + @"<wsdl:operation name=""GetListItemChangesSinceToken"">"
                + @"    <wsdl:input message=""GetListItemChangesSinceTokenSoapIn"" />"
                + @"    <wsdl:output message=""GetListItemChangesSinceTokenSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R654
            // 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(
                654,
                @"[In GetListItemChangesSinceToken operation] [If the protocol client sends a "
                + "GetListItemChangesSinceTokenSoapIn request message] the protocol server "
                + "responds with a GetListItemChangesSinceTokenSoapOut response message.");

            // Verify R1882
            // 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(
                1882,
                @"[GetListItemChangesSinceTokenSoapOut]The SOAP Body contains a "
                + "GetListItemChangesSinceTokenResponse element.");

            // Verify R1897
            // 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(
                1897,
                @"[The schema of GetListItemChangesSinceTokenResponse is defined as:] <s:element name=""GetListItemChangesSinceTokenResponse"">
              <s:complexType>
                <s:sequence>
                    <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemChangesSinceTokenResult"">
                     <s:complexType mixed=""true"">
                      <s:sequence>
                        <s:element name=""listitems"" >
                          <s:complexType>
                            <s:sequence>
                              <s:element name=""Changes"" >
                                <s:complexType>
                                  <s:sequence>
                                    <s:element name=""List"" type=""tns:ListDefinitionSchema""  
                                               minOccurs=""0"" />
                                    <s:element name=""Id"" type=""tns:ListItemChangeDefinition"" minOccurs=""0""/>                      
                                  </s:sequence>
                                  <s:attribute name=""LastChangeToken"" type=""s:string"" />
                                  <s:attribute name=""MoreChanges"" type=""core:TRUEFALSE"" />
                                  <s:attribute name=""MinTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                  <s:attribute name=""RecommendedTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                  <s:attribute name=""MaxBulkDocumentSyncSize"" type=""s:unsignedInt"" />
                                  <s:attribute name=""MaxRecommendedEmbeddedFileSize"" type=""s:unsignedInt"" />
                                  <s:attribute name=""AlternateUrls"" type=""s:string"" />
                                  <s:attribute name=""EffectivePermMask"" type=""s:string"" />
                                </s:complexType>
                              </s:element>
                              <s:any />
                            </s:sequence> 
                          </s:complexType>
                        </s:element>
                      </s:sequence>
                    </s:complexType>
                  </s:element>
                </s:sequence>     
              </s:complexType>
            </s:element>");

            // Verify R1898
            // 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(
                1898,
                @"[GetListItemChangesSinceTokenResponse]GetListItemChangesSinceTokenResult:  The top-level element, which contains a listitems element.");

            // Verify R1908
            // In MS-LISTSWS.wsdl. The 'any' element has been replaced by rs:data.
            // 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(
                1908,
                @"[GetListItemChangesSinceTokenResponse]The listitems element also contains an inner element named rs:data, which is of type DataDefinition ListItemCollectionPositionNext (section 2.2.4.7).");

            // Verify R2486
            if (Common.IsRequirementEnabled(2486, this.Site))
            {
                if (getListItemChangesSinceTokenResult.listitems.Changes.List != null)
                {
                    bool isFileFragmentExist = getListItemChangesSinceTokenResult.listitems.Changes.List.Fields.Field.Any(field => field.Name == "FileFragment");
                    Site.CaptureRequirementIfIsFalse(
                        isFileFragmentExist,
                        2486,
                        @"[In GetListItemChangesSinceToken operation]Implementation does not return the FileFragment element.[In Appendix B: Product Behavior] <61> Section 3.1.4.22.2.2: In Windows SharePoint Services 3.0, the FileFragment element is not returned.");
                }
            }

            // Verify the requirements of the DataDefinition complex type.
            if (getListItemChangesSinceTokenResult.listitems.data != null)
            {
                this.VerifyDataDefinition(getListItemChangesSinceTokenResult.listitems.data);
            }

            // Verify the requirements of the ListDefinitionSchema complex type.
            if (getListItemChangesSinceTokenResult.listitems.Changes.List != null)
            {
                this.VerifyListDefinitionSchema(getListItemChangesSinceTokenResult.listitems.Changes.List);
            }

            // Verify the requirements of the ListItemChangeDefinition complex type.
            if (null != getListItemChangesSinceTokenResult.listitems && null != getListItemChangesSinceTokenResult.listitems.Changes
                && null != getListItemChangesSinceTokenResult.listitems.Changes && null != getListItemChangesSinceTokenResult.listitems.Changes.Id)
            {
                this.VerifyListItemChangeDefinition(getListItemChangesSinceTokenResult.listitems.Changes.Id);
                this.VerifyServerChangeUnitAttributeNotReturn(getListItemChangesSinceTokenResult.listitems.Changes.Id);
            }

            // Verify the requirements of the EnumViewAttributes simple type.
            if (queryOptions != null)
            {
                if (getListItemChangesSinceTokenResult.listitems.data.Any != null)
                {
                    DataTable data = AdapterHelper.ExtractData(getListItemChangesSinceTokenResult.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();
                        }
                    }
                }
            }
            // Verify R1907
            // 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(
                   1907,
                   @"[GetListItemChangesSinceTokenResponse]Note that set of fields returned by the method is restricted by the viewField or viewName parameter.");
        }
        public void MSOUTSPS_S02_TC33_OperationListItems_TimeZoneSetByProtocolSUT()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // Setting recurring setting
            DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1);
            string eventTitle = this.GetUniqueListItemTitle("DailyRecurrenceEvent");
            Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(eventTitle, eventDateOfRecurrence, "1", 10);
            List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>();

            this.Site.Assert.AreEqual<string>(
                                    "1",
                                    settingsOfDailyRecurring["fRecurrence"].ToLower(),
                                    "The fRecurrence field should be '1' in this test case.");

            this.Site.Assert.IsFalse(
                                settingsOfDailyRecurring.ContainsKey("TimeZone"),
                                "The TimeZone field should absent from the request in this test case.");

            addedItemsOfRecurrence.Add(settingsOfDailyRecurring);

            // add a  recurrence appointment item whose duration is 10 days, and each instance of this recurrence item will be repeat on "Daily". There should be 10 instances of this item.
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addedItemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);

            // Get list item id from the response of UpdateListItems operation.
            this.VerifyResponseOfUpdateListItem(updateResult);
            List<string> addedRecurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Set "<ViewFields />" in order to show all fields' value of a list.
                CamlViewFields viewFields = new CamlViewFields();
                viewFields.ViewFields = new CamlViewFieldsViewFields();

                // Call GetListItemChangesSinceToken operation to get list items change.
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                         listId,
                                         null,
                                         null,
                                         viewFields,
                                         null,
                                         null,
                                         null,
                                         null);

                // Get the list items change data.
                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);
                int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, addedRecurrenceItemIds[0]);
                string timeZoneValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_TimeZone");

                if (Common.IsRequirementEnabled(1270, this.Site))
                {
                    // If the TimeZone field value is set by protocol SUT, and it is valid integer value, than capture R1270
                    if (!string.IsNullOrEmpty(timeZoneValue))
                    {
                        int timeZoneIntValue;
                        if (!int.TryParse(timeZoneValue, out timeZoneIntValue))
                        {
                            this.Site.Assert.Fail("The TimeZone field value should be valid integer value.");
                        }

                        // Verify MS-OUTSPS requirement: MS-OUTSPS_R1270
                        this.Site.CaptureRequirement(
                                                  1270,
                                                  @"[In Appendix B: Product Behavior] [If does not leave it empty]Implementation does set a number in this value[TimeZone].(Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
                    }
                }
            }
        }
        /// <summary>
        /// Verify the message syntax of GetListItemChangesWithKnowledge operation when the 
        /// response is received successfully.
        /// </summary>
        /// <param name="getListItemChangesWithKnowledgeResult">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 VerifyGetListItemChangesWithKnowledgeOperation(
            GetListItemChangesWithKnowledgeResponseGetListItemChangesWithKnowledgeResult getListItemChangesWithKnowledgeResult,
            CamlQueryOptions queryOptions,
            CamlViewFields viewFields)
        {
            if (getListItemChangesWithKnowledgeResult != null)
            {
                // Verify R1079
                // 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(
                    1079,
                    @"[The schema of GetListItemChangesWithKnowledge is defined as:]"
                    + @"<wsdl:operation name=""GetListItemChangesWithKnowledge"">"
                    + @"    <wsdl:input message=""GetListItemChangesWithKnowledgeSoapIn"" />"
                    + @"    <wsdl:output message=""GetListItemChangesWithKnowledgeSoapOut"" />"
                    + @"</wsdl:operation>");

                // Verify R1081
                // 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(
                    1081,
                    @"[In GetListItemChangesWithKnowledge operation]The protocol client sends a "
                    + "GetListItemChangesWithKnowledgeSoapIn request message ,the protocol "
                    + "server responds with a GetListItemChangesWithKnowledgeSoapOut response "
                    + "message,");

                // Verify R1096
                // 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(
                    1096,
                    @"[In GetListItemChangeswithKnowledgeSoapOut]The SOAP Body contains a "
                    + "GetListItemChangesWithKnowledgeResponse element.");

                // Verify R1124
                // 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(
                    1124,
                    @"[The schema of GetListItemChangesWithKnowledgeResponse is defined as: ]
                <s:element name=""GetListItemChangesWithKnowledgeResponse"">
                  <s:complexType>
                    <s:sequence>
                      <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemChangesWithKnowledgeResult"">
                        <s:complexType mixed=""true"">
                          <s:sequence>
                            <s:element name=""listitems"" >
                              <s:complexType>
                                <s:sequence>
                                  <s:element name=""Changes"" >
                                    <s:complexType>
                                      <s:sequence>
                                        <s:element name=""MadeWithKnowledge"" minOccurs=""0"" maxOccurs=""1"">
                                          <s:complexType>
                                            <s:sequence>
                                              <s:element ref=""sync:syncKnowledge"" />
                                            </s:sequence>
                                          </s:complexType>
                                        </s:element>
                                        <s:element name=""Id"" type=""tns:ListItemChangeDefinition"" minOccurs=""0""/>
                                        <s:element name=""View"" type=""tns:ViewChangeDefinition"" minOccurs=""0""/>
                                      </s:sequence>
                                      <s:attribute name=""SchemaChanged"" type=""core:TRUEFALSE"" />
                                      <s:attribute name=""ServerTime"" type=""s:string"" />
                                      <s:attribute name=""MoreChanges"" type=""core:TRUEFALSE"" />
                                      <s:attribute name=""MinTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                      <s:attribute name=""RecommendedTimeBetweenSyncs"" type=""s:unsignedInt"" />
                                      <s:attribute name=""MaxBulkDocumentSyncSize"" type=""s:unsignedInt"" />
                                      <s:attribute name=""MaxRecommendedEmbeddedFileSize"" type=""s:unsignedInt"" />
                                      <s:attribute name=""AlternateUrls"" type=""s:string"" />
                                      <s:attribute name=""EffectivePermMask"" type=""s:string"" />
                                    </s:complexType>
                                  </s:element>
                                  <s:any />
                                </s:sequence>
                              </s:complexType>
                            </s:element>
                          </s:sequence>
                        </s:complexType>
                      </s:element>
                    </s:sequence>     
                  </s:complexType>
                </s:element>");

                // Verify R1125
                // 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(
                    1125,
                    @"[In GetListItemChangesWithKnowledgeResponse]GetListItemChangesWithKnowledgeResult: The top-level element, which contains a listitems element.");

                // Verify R1137
                // The schema from MS-XSSK has been added to MS-LISTSWS.wsdl.
                // 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(
                    1137,
                    @"[In GetListItemChangesWithKnowledgeResponse]The inner XML of the MadeWithKnowledge element in the Changes element is the knowledge in XML format, as specified in [MS-XSSK] section 3, that represents the last change in the list that is returned to the client.");

                // Verify R1145
                // The response have been received successfully, which means the schema
                // of the listitems element past the validation, then the following requirement can be 
                // captured.
                Site.CaptureRequirement(
                    1145,
                    @"[In GetListItemChangesWithKnowledgeResponse]The listitems element also "
                    + "contains an inner element named rs:data, which is of type DataDefinition. (section 2.2.4.7)");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R1361
                // If the Created can be parsed to a DateTime, capture R1135
                if (null != getListItemChangesWithKnowledgeResult.listitems && null != getListItemChangesWithKnowledgeResult.listitems.Changes
                    && !string.IsNullOrEmpty(getListItemChangesWithKnowledgeResult.listitems.Changes.ServerTime))
                {
                    DateTime created;
                    string paserFormat = @"yyyyMMdd HH:mm:ss";
                    string returnDataTimeValue = getListItemChangesWithKnowledgeResult.listitems.Changes.ServerTime;
                    bool isVerifyR1135 = DateTime.TryParseExact(returnDataTimeValue, paserFormat, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out created);

                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "The actual values: returnDataTimeValue[{0}] for requirement #R1361",
                        string.IsNullOrEmpty(returnDataTimeValue) ? "NullOrEmpty" : returnDataTimeValue);

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR1135,
                        1135,
                        @"[In GetListItemChangesWithKnowledgeResponse][Attribute of ServerTime]The ServerTime attribute specifies the UTC date and time in the Gregorian calendar "
                        + @"when the changes were returned by the server in the format ""yyyyMMdd hh:mm:ss"" where ""yyyy"" represents the year, ""MM"" represents the month, ""dd"" represents the day of the month, "
                        + @"""hh"" represents the hour, ""mm"" represents the minute, and ""ss"" represents the second.");
                }
            }

            if ((queryOptions != null)
                && (getListItemChangesWithKnowledgeResult.listitems.data.Any != null))
            {
                DataTable data = AdapterHelper.ExtractData(getListItemChangesWithKnowledgeResult.listitems.data.Any);
                string author = data.Columns.Contains("ows_Author") ? Convert.ToString(data.Rows[0]["ows_Author"]) : null;
                this.VerifyCamlQueryOptions(queryOptions, viewFields, author);
            }

            // Verify the requirements of the DataDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.data != null)
            {
                this.VerifyDataDefinition(getListItemChangesWithKnowledgeResult.listitems.data);
            }

            // Verify the requirements of FileFolderChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.File != null)
            {
                this.VerifyFileFolderChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.File);
            }

            if (getListItemChangesWithKnowledgeResult.listitems.Changes.Folder != null)
            {
                this.VerifyFileFolderChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.Folder);
            }

            // Verify the requirements of FileFragmentChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.FileFragment != null)
            {
                this.VerifyFileFragmentChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.FileFragment);
            }

            // Verify the requirements of the ListItemChangeDefinition complex type.
            if (getListItemChangesWithKnowledgeResult.listitems.Changes.Id != null)
            {
                this.VerifyListItemChangeDefinition(getListItemChangesWithKnowledgeResult.listitems.Changes.Id[0]);
            }

            // Verify the requirements of the EnumViewAttributes simple type.
            if (queryOptions != null)
            {
                if (queryOptions.QueryOptions != null)
                {
                    if (queryOptions.QueryOptions.ViewAttributes != null)
                    {
                        if (queryOptions.QueryOptions.ViewAttributes.ScopeSpecified)
                        {
                            this.VerifyEnumViewAttributes();
                        }
                    }
                }
            }
        }
        public void MSOUTSPS_S02_TC41_AddDiscussionBoardItem()
        {
            // Add a discussion board list.
            string listId = this.AddListToSUT(TemplateType.Discussion_Board);
            byte[] messageData = this.GetMessageDataForAddDiscussionBoardItem();

            // Call AddDiscussionBoardItem operation to add a discussionBoard item
            AddDiscussionBoardItemResponseAddDiscussionBoardItemResult responseOfAddDiscussionBoardItem = null;
            responseOfAddDiscussionBoardItem = OutspsAdapter.AddDiscussionBoardItem(listId, messageData);
            this.Site.Assert.IsNotNull(
                         responseOfAddDiscussionBoardItem.listitems.data,
                         "The response of AddDiscussionBoardItem operation should contain [zrow] data structure under [listitems] element.");

            this.Site.Assert.IsNotNull(
                          responseOfAddDiscussionBoardItem.listitems.data.Any,
                          "The response of AddDiscussionBoardItem operation should contain at least one zrow item.");

            XmlNode[] zrowItems = this.GetZrowItems(responseOfAddDiscussionBoardItem.listitems.data.Any);
            this.Site.Assert.AreEqual<int>(
                             1,
                             zrowItems.Count(),
                             "The response of AddDiscussionBoardItem operation should contain only one zrow item.");

            string listItemIdOfDiscussionBoardItem = Common.GetZrowAttributeValue(zrowItems, 0, "ows_ID");
            this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(listItemIdOfDiscussionBoardItem),
                                "The response of AddDiscussionBoardItem operation should contain the Id field value.");

            // If the response of AddDiscussionBoardItem operation succeed, then capture R10860, R1088
            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10860
            this.Site.CaptureRequirement(
                            10860,
                            @"[In Messages]AddDiscussionBoardItemResponse specified the response to a request to add new discussion items to a list.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1088
            this.Site.CaptureRequirement(
                             1088,
                             @"[In AddDiscussionBoardItemResponse]The item identifier is found in the attribute AddDiscussionBoardItemResponse.AddDiscussionBoardItemResult.listitems.data.row.ows_ID.");

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                                        listId,
                                                        null,
                                                        null,
                                                        viewfieds,
                                                        null,
                                                        null,
                                                        null,
                                                        null);

                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItemsOfGetListItemChangesSinceToken = this.GetZrowItems(listItemChangesRes.listitems.data.Any);

                // Current discussion board list only contain 1 item, so the list item id should be 1. The zrow items should contain the added list item data.
                // If there are no any match zrow items found in zrow items array, this method will throw Assert exception.
                this.GetZrowItemIndexByListItemId(zrowItemsOfGetListItemChangesSinceToken, "1");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R1063
                this.Site.CaptureRequirement(
                                 1063,
                                 @"[In Message Processing Events and Sequencing Rules][The operation]AddDiscussionBoardItem Adds a new discussion item to a list.");
            }
        }
        /// <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();
                        }
                    }
                }
            }
        }
        public void MSOUTSPS_S02_TC44_GenericList_VerifyVtiVersionHistoryValue()
        {
            string listId = this.AddListToSUT(TemplateType.Generic_List);

            // Add one item
            List<string> listItemIds = this.AddItemsToList(listId, 1);
            string listItemId = listItemIds[0];

            // Set "<ViewFields />" settings in order to view the properties' in properties bag, more detail is described in [MS-LISTSWS] section 2.2.4.5
            CamlViewFields viewfieds = new CamlViewFields();
            viewfieds.ViewFields = new CamlViewFieldsViewFields();
            viewfieds.ViewFields.Properties = bool.TrueString;
            viewfieds.ViewFields.FieldRef = new CamlViewFieldsViewFieldsFieldRef[1];
            viewfieds.ViewFields.FieldRef[0] = new CamlViewFieldsViewFieldsFieldRef();
            viewfieds.ViewFields.FieldRef[0].Name = "MetaInfo";

            XmlNode[] zrowItemsOfAddedItem = this.GetListItemsChangesFromSUT(listId, viewfieds);
            List<Dictionary<string, int>> vtiVersionHistoryValueOfAdded = this.GetVtiVersionHistoryValue(zrowItemsOfAddedItem, listItemId);

            // Update the existing item, make the vti_versionHistory change.
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>();
            cmds.Add(MethodCmdEnum.Update);

            // Set the target existing list item id
            Dictionary<string, string> updateSettingsOfListItem = new Dictionary<string, string>();
            updateSettingsOfListItem.Add("ID", listItemId);
            updateSettingsOfListItem.Add("Title", this.GetUniqueListItemTitle("Generic"));
            List<Dictionary<string, string>> updatedSettings = new List<Dictionary<string, string>>();
            updatedSettings.Add(updateSettingsOfListItem);
            UpdateListItemsUpdates updates = this.CreateUpdateListItems(cmds, updatedSettings, OnErrorEnum.Continue);

            // Update the existing list item.
            OutspsAdapter.UpdateListItems(listId, updates);

            XmlNode[] zrowItemsOfUpdatedItem = this.GetListItemsChangesFromSUT(listId, viewfieds);
            List<Dictionary<string, int>> vtiVersionHistoryValueOfUpdated = this.GetVtiVersionHistoryValue(zrowItemsOfUpdatedItem, listItemId);

            string guidPartValueOfAdded = vtiVersionHistoryValueOfAdded[0].ElementAt(0).Key;
            int integerPartValueOfAdded = vtiVersionHistoryValueOfAdded[0].ElementAt(0).Value;

            string guidPartValueOfUpdated = vtiVersionHistoryValueOfUpdated[0].ElementAt(0).Key;
            int integerPartValueOfUpdated = vtiVersionHistoryValueOfUpdated[0].ElementAt(0).Value;

            Guid guidOfAddedItem;
            string expectedGuidFormat = @"N";
            if (!Guid.TryParseExact(guidPartValueOfAdded, expectedGuidFormat, out guidOfAddedItem))
            {
                this.Site.Assert.Fail("The GUID part should be a valid GUID format, actual value:[{0}]", guidPartValueOfAdded);
            }

            Guid guidOfUpddatedItem;
            if (!Guid.TryParseExact(guidPartValueOfUpdated, expectedGuidFormat, out guidOfUpddatedItem))
            {
                this.Site.Assert.Fail("The GUID part should be a valid GUID format, actual value:[{0}]", guidOfUpddatedItem);
            }

            // If the GUID part value is it is "N" format ("hexadecimal string with no non-hexadecimal characters" format), then capture R218.
            this.Site.CaptureRequirement(
                                        218,
                                        @"[In Common Schema][vti_versionhistory:]GUIDs are written as a hexadecimal string with no non-hexadecimal characters.");

            // If the GUID part value is same GUID value, then capture R214, R229, R219
            bool isUseSameGuid = guidOfAddedItem.Equals(guidOfUpddatedItem);

            this.Site.Log.Add(
                            LogEntryKind.Debug,
                            @"GUID part value[{0}] in add item operation should be equal to the value[{0}] in update item.",
                            guidOfAddedItem,
                            guidOfUpddatedItem);

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R214
            this.Site.CaptureRequirementIfIsTrue(
                                           isUseSameGuid,
                                           214,
                                           @"[In Common Schema][vti_versionhistory:]Each unique GUID MUST appear at most once in the list.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R229
            this.Site.CaptureRequirementIfIsTrue(
                                           isUseSameGuid,
                                           229,
                                           @"[In Common Schema][vti_versionhistory:]This GUID[generated by every client and server that edits items] is reused and not regenerated.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R219
            this.Site.CaptureRequirementIfIsTrue(
                                           isUseSameGuid,
                                           219,
                                           @"[In Common Schema][vti_versionhistory:]Version history is built in the following way:Every protocol client and protocol server that edits items generates a GUID.");

            // If the integer part value is increased, then capture the R215, R222, R224
            bool isIntegerIncrease = integerPartValueOfUpdated > integerPartValueOfAdded;

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R215
            this.Site.CaptureRequirementIfIsTrue(
                                         isIntegerIncrease,
                                         215,
                                         @"[In Common Schema][vti_versionhistory:]One integer MUST be greater than all other integers.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R222
            this.Site.CaptureRequirementIfIsTrue(
                                        isIntegerIncrease,
                                        222,
                                        @"[In Common Schema][vti_versionhistory:]Each time an item is updated, the highest integer is found among the GUID-integer pairs.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R224
            this.Site.CaptureRequirementIfIsTrue(
                                        isIntegerIncrease,
                                        224,
                                        @"[In Common Schema][Version history is built in the following way: 2.]That integer is incremented by one to get the integer to use in step '3'.");

            // If the GUID part and Integer part value are pass the upon verification, then capture R212, R592
            this.Site.Assert.IsTrue(isIntegerIncrease, "The Integer part value of vti_versionhistory should be increased from previous value.");
            this.Site.Assert.IsTrue(isUseSameGuid, "The GUID part value of vti_versionhistory should be equal to previous value for same protocol client.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R212
            this.Site.CaptureRequirement(
                                        212,
                                        @"[In Common Schema]vti_versionhistory: Version history is a list of GUIDs and integers in the following format: GUID:Integer,GUID:Integer,GUID:Integer");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R592
            this.Site.CaptureRequirement(
                                        592,
                                        @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]vti_versionhistory<22>[ Field.ID:]None defined[Field.Type:]None defined (see description following the table).");

            // If the update item's vti_versionhistory use the same GUID and only have one GUID-Integer name-value pairs, then capture R225, R226
            int nameValuePairsItemCounter = vtiVersionHistoryValueOfUpdated[0].Count;

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R225
            this.Site.CaptureRequirementIfAreEqual<int>(
                                        1,
                                        nameValuePairsItemCounter,
                                        225,
                                        @"[In Common Schema][vti_versionhistory:]The editing protocol client or protocol server searches for its GUID in the GUID-integer pairs and removes the pair if it is found.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R226
            this.Site.CaptureRequirementIfAreEqual<int>(
                                        1,
                                        nameValuePairsItemCounter,
                                        226,
                                        @"[In Common Schema][Version history is built in the following way: 3.]Then the editing protocol client or protocol server inserts a new GUID-integer pair using its GUID and the integer from step '2'.");
        }
        /// <summary>
        /// The GetListItemChangesSinceToken operation is used to return changes made to a specified list after the event
        /// expressed by the change token, if specified, or to return all the list items in the list.
        /// </summary>
        /// <param name="listName">The name of the list from which version collection will be got</param>
        /// <param name="viewName">The GUID refers to a view of the list</param>
        /// <param name="query">The query to determine which records from the list are to be 
        /// returned and the order in which they will be returned</param>
        /// <param name="viewFields">Specifies which fields of the list item will be returned</param>
        /// <param name="rowLimit">Indicate the maximum number of rows of data to return</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="changeToken">Assigned a string comprising a token returned by a previous 
        /// call to this operation.</param>
        /// <param name="contains">Specifies a value to search for</param>
        /// <returns>A return value represent the list item changes since the specified token</returns>
        public GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult GetListItemChangesSinceToken(string listName, string viewName, GetListItemChangesSinceTokenQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string changeToken, CamlContains contains)
        {
            if (null == this.listsProxy)
            {
                throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter");
            }

            GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult result = null;
            result = this.listsProxy.GetListItemChangesSinceToken(listName, viewName, query, viewFields, rowLimit, queryOptions, changeToken, contains);
            this.VerifyTransportRequirement();
            this.VerifyGetListItemChangesSinceTokenResponse(result);

            return result;
        }
        public void MSOUTSPS_S02_TC05_OperationListItems_fAllDayEventIsTrue()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = DateTime.Today.Date.AddDays(1);
            DateTime endDate = eventDate.Date.AddHours(1);
            string eventDateValue = this.GetGeneralFormatTimeString(eventDate);
            string endDateValue = this.GetGeneralFormatTimeString(endDate);
            string eventTitle = this.GetUniqueListItemTitle("RecurrenceEvent");

            recurEventFieldsSetting.Add("Title", eventTitle);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // "0" indicates a single instance.
            recurEventFieldsSetting.Add("EventType", "0");

            // "1" means this is an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "1");

            // "0" means this is not a recurrence event.
            recurEventFieldsSetting.Add("fRecurrence", "0");

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            this.VerifyResponseOfUpdateListItem(updateResult);

            // Set "<ViewFields />" in order to show all fields' value of a list.
            CamlViewFields viewfieds = new CamlViewFields();
            viewfieds.ViewFields = new CamlViewFieldsViewFields();

            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");

            #region Capture code

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R439
            this.Site.CaptureRequirementIfAreEqual(
                "1",
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_fAllDayEvent"),
                439,
                "[In Appointment-Specific Schema][For fAllDayEvent, the value ]1 means TRUE.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R280
            this.Site.CaptureRequirementIfAreEqual(
                "1",
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_fAllDayEvent"),
                280,
                "[In Appointment-Specific Schema]fAllDayEvent: A booleanInteger value that specifies whether the appointment is an all-day appointment, as specified in the appointments (section 3.2.1.1) abstract data model.");

            #endregion
        }
        /// <summary>
        /// The GetListItemChanges operation is used to retrieve the list items that have been inserted or updated
        /// since the specified date and time and matching the specified filter criteria.
        /// </summary>
        /// <param name="listName">The name of the list from which the list item changes will be got</param>
        /// <param name="viewFields">Indicates which fields of the list item SHOULD be returned</param>
        /// <param name="since">The date and time to start retrieving changes in the list
        /// If the parameter is null, protocol server should return all list items
        /// If the date that is passed in is not in UTC format, protocol server will use protocol server's local time zone and convert it to UTC time</param>
        /// <param name="contains">Restricts the results returned by giving a specific value to be searched for in the specified list item field</param>
        /// <returns>Return the list item change result</returns>
        public GetListItemChangesResponseGetListItemChangesResult GetListItemChanges(string listName, CamlViewFields viewFields, string since, CamlContains contains)
        {
            if (null == this.listsProxy)
            {
                throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter");
            }

            GetListItemChangesResponseGetListItemChangesResult result = null;
            result = this.listsProxy.GetListItemChanges(listName, viewFields, since, contains);
            this.VerifyTransportRequirement();

            return result;
        }
        public void MSOUTSPS_S02_TC51_OperationListItemsForDocument()
        {
            // Add document library
            string documentLibraryTitle = this.GetUniqueListName(TemplateType.Document_Library.ToString());
            string listId = this.AddListToSUT(documentLibraryTitle, TemplateType.Document_Library);

            // Add a folder into the list.
            string folderItemName = this.GetUniqueFolderName();
            this.AddFolderIntoList(listId, folderItemName);

            // Upload a file to the folder.
            string fileName = this.GetUniqueUploadFileName();
            string fileUrl = SutControlAdapter.UploadFileWithFolder(documentLibraryTitle, folderItemName, fileName);
            this.Site.Assert.IsFalse(
                           string.IsNullOrEmpty(fileUrl),
                           "The uploading file to list[{0}] process should be succeed. Expected file name:[{1}]",
                            documentLibraryTitle,
                            fileName);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                                        listId,
                                                        null,
                                                        null,
                                                        viewfieds,
                                                        null,
                                                        null,
                                                        null,
                                                        null);

                // Get the list items' changes.
                this.VerifyContainZrowDataStructure(listItemChangesRes);
                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);

                // Current list only have two items, the first is the folder item, the second is the file item. so the list item is 2.
                int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, "2");

                string contentTypeId = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_ContentTypeId");
                string id = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_ID");
                string hiddenversion = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_owshiddenversion");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R208
                this.Site.CaptureRequirementIfIsTrue(
                    !string.IsNullOrEmpty(contentTypeId) && !string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(hiddenversion),
                    208,
                    "[In Common Schema]Unless stated otherwise[Attachments, Categories, Created, Modified, ReplicationID, vti_versionhistory], all fields in this section[ContentTypeId, ID, owshiddenversion] MUST be present on all item types<20> and contain valid data.");

                string encodedAbsUrl = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_EncodedAbsUrl");
                string fileSizeDisplay = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_FileSizeDisplay");
                string linkFilename = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_LinkFilename");

                // If the upload file can be get by the HTTP GET method correctly by using encodedAbsUrl field value, then capture R728.
                this.Site.Assert.IsFalse(
                               string.IsNullOrEmpty(encodedAbsUrl),
                               "The encodedAbsUrl field should have value.");

                // Get the document item content.
                Uri fullUrlOfAttachmentPath;
                if (!Uri.TryCreate(encodedAbsUrl, UriKind.RelativeOrAbsolute, out fullUrlOfAttachmentPath))
                {
                    this.Site.Assert.Fail("The full url of attachment should be valid Uri format string.");
                }

                byte[] documentItemData = null;
                documentItemData = OutspsAdapter.HTTPGET(fullUrlOfAttachmentPath, "f");
                this.Site.Assert.IsNotNull(
                                documentItemData,
                                "The upload file[{0}] should be get by the HTTP GET method correctly by using encodedAbsUrl field value[{1}].",
                                fileName,
                                encodedAbsUrl);

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R728
                this.Site.CaptureRequirement(
                                728,
                                @"[In Document-Specific Schema]This[EncodedAbsUrl] MUST be present and valid.");

                // If the downloaded file content's size equal to the fileSizeDisplay field, then capture R734
                this.Site.Assert.IsFalse(
                              string.IsNullOrEmpty(fileSizeDisplay),
                              "The fileSizeDisplay field should have value.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R734
                this.Site.CaptureRequirementIfAreEqual<string>(
                                    fileSizeDisplay,
                                    documentItemData.Count().ToString(),
                                    734,
                                    "[In Document-Specific Schema]This[FileSizeDisplay] MUST be present and valid.");

                // If the linkFilename field value equal to the upload file name specified in previous step, then capture R741.
                this.Site.Assert.IsFalse(
                            string.IsNullOrEmpty(linkFilename),
                            "The linkFilename field should have value.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R741
                this.Site.CaptureRequirementIfAreEqual<string>(
                                    fileName.ToLower(),
                                    linkFilename.ToLower(),
                                    741,
                                    @"[In Document-Specific Schema]This[LinkFilename] MUST be present and valid.");

                if (Common.IsRequirementEnabled(732, this.Site))
                {
                    // Verify the fileDirRef field, it should contain the parent path of the upload file: rootFolder(documentLibraryTitle)/folder(folderItemName).
                    string fileDirRef = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_FileDirRef");
                    this.Site.Assert.IsFalse(
                             string.IsNullOrEmpty(fileDirRef),
                             "The fileDirRef field should have value.");

                    string actualFileDirRefValue = this.ParseRegularLookUpType(fileDirRef);
                    string expectedDirPath = string.Format(@"{0}/{1}", documentLibraryTitle, folderItemName);
                    this.Site.Assert.IsTrue(
                                        actualFileDirRefValue.IndexOf(expectedDirPath, StringComparison.OrdinalIgnoreCase) >= 0,
                                        "The FileDirRef field's value should include the expected path. FileDirRef field[{0}]\r\n Expected path[{1}] ",
                                        actualFileDirRefValue,
                                        expectedDirPath);

                    // Verify MS-OUTSPS requirement: MS-OUTSPS_R732
                    this.Site.CaptureRequirement(
                                        732,
                                        @"[In Appendix B: Product Behavior] Implementation does appear at the beginning of the FileDirRef value.(Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
                }

                // Verify user type fields for the folder item, the folder item is added as first item of the list.
                int zrowIndexOfFolderItem = this.GetZrowItemIndexByListItemId(zrowItems, "1");
                string currentUserValue = this.GetUserTypeValue();
                string authorValue = Common.GetZrowAttributeValue(zrowItems, zrowIndexOfFolderItem, "ows_Author");
                this.VerifyUserType(authorValue, currentUserValue, "Author");

                string editorValue = Common.GetZrowAttributeValue(zrowItems, zrowIndexOfFolderItem, "ows_Editor");
                this.VerifyUserType(editorValue, currentUserValue, "Editor");
            }
        }
        /// <summary>
        /// A method used to construct CamlViewFields instance using the specified parameters.
        /// </summary>
        /// <param name="property">A Boolean value indicate whether the Prosperities attribute value is TRUE/FALSE</param>
        /// <param name="fieldNames">Specified the CamlViewFields instance's fields.</param>
        /// <returns>Returns the CamlViewFields instance.</returns>
        public static CamlViewFields CreateViewFields(bool property, List<string> fieldNames)
        {
            CamlViewFields viewFields = new CamlViewFields();
            viewFields.ViewFields = new CamlViewFieldsViewFields();
            viewFields.ViewFields.Properties = property == true ? "TRUE" : "FALSE";

            int fieldCount = fieldNames.Count;
            viewFields.ViewFields.FieldRef = new CamlViewFieldsViewFieldsFieldRef[fieldCount];

            for (int i = 0; i < fieldCount; i++)
            {
                viewFields.ViewFields.FieldRef[i] = new CamlViewFieldsViewFieldsFieldRef();
                viewFields.ViewFields.FieldRef[i].Name = fieldNames[i];
            }

            return viewFields;
        }
        public void MSOUTSPS_S02_TC53_OperateOnListItems_VerifyListItemCollectionPositionNextValue()
        {
            string listId = this.AddListToSUT(TemplateType.Generic_List);

            // Add 10 list items.
            this.AddItemsToList(listId, 10);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Setting "<viewFields />" to view all fields of the list.
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                // Set the low limited value equal to 2 without applying the change token in the request, in order to the actual response contain ListItemCollectionPositionNextValue value.
                int rowListmitedValue = 2;
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId,
                                            null,
                                            null,
                                            viewfieds,
                                            rowListmitedValue.ToString(),
                                            null,
                                            null,
                                            null);

                XmlNode[] zrowItems = this.GetZrowItems(listItemChangesRes.listitems.data.Any);

                this.Site.Assert.AreEqual<int>(
                                            rowListmitedValue,
                                            zrowItems.Length,
                                            "The return zrow item should match the specified row limit value.");

                if (null == listItemChangesRes || null == listItemChangesRes.listitems || null == listItemChangesRes.listitems.Changes)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken should contain the valid the changes data.");
                }

                // If the ListItemCollectionPositionNextValue present then capture R1226.
                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(listItemChangesRes.listitems.data.ListItemCollectionPositionNext),
                                "The response of GetListItemChangesSinceToken should contain ListItemCollectionPositionNextValue value.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R1226
                this.Site.CaptureRequirement(
                                    1226,
                                    @"[In GetListItemChangesSinceTokenResponse][If present condition meet][The attribute]data.ListItemCollectionPositionNext is contained within GetListItemChangesSinceTokenResponse.GetListItemChangesSinceTokenResult.listitems, as specified by [MS-LISTSWS].");
            }
        }
        public void MSOUTSPS_S02_TC15_OperateOnListItems_VerifyChangeTypeValue()
        {
            string listId1 = this.AddListToSUT(TemplateType.Generic_List);
            string listId2 = this.AddListToSUT(TemplateType.Generic_List);
            this.AddItemsToList(listId2, 10);

            if (Common.IsRequirementEnabled(106802, this.Site))
            {
                // Call GetListItemChangesSinceToken operation to get the changetoken on list 1.
                GetListItemChangesSinceTokenResponseGetListItemChangesSinceTokenResult listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                          listId1,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null,
                                          null);

                if (null == listItemChangesRes || null == listItemChangesRes.listitems || null == listItemChangesRes.listitems.Changes)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken should contain the valid the changes data.");
                }

                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(listItemChangesRes.listitems.Changes.LastChangeToken),
                                "The response of GetListItemChangesSinceToken should contain valid ChangeToken.");

                string changeTokenValue = listItemChangesRes.listitems.Changes.LastChangeToken;

                // Add 10 list items into list 2.
                this.AddItemsToList(listId2, 10);

                // Setting "<viewFields />" to view all fields of the list.
                CamlViewFields viewfieds = new CamlViewFields();
                viewfieds.ViewFields = new CamlViewFieldsViewFields();

                // Set the changeToken from list 1, it is not valid for list 2, so that the protocol SUT will return ChangeType value in Id element, this means protocol SUT could not query information for list items.
                listItemChangesRes = null;
                listItemChangesRes = OutspsAdapter.GetListItemChangesSinceToken(
                                            listId2,
                                            null,
                                            null,
                                            viewfieds,
                                            null,
                                            null,
                                            changeTokenValue,
                                            null);

                if (null == listItemChangesRes || null == listItemChangesRes.listitems || null == listItemChangesRes.listitems.Changes)
                {
                    this.Site.Assert.Fail("The response of GetListItemChangesSinceToken should contain the valid the changes data.");
                }

                // If the Id element present and the ChangeType value equal to "InvalidToken", then capture 1223
                this.Site.Assert.IsNotNull(
                                        listItemChangesRes.listitems.Changes.Id,
                                        @"The response of GetListItemChangesSinceToken should contain Id element if the request contains invalid changeToken value.");

                this.Site.Assert.IsTrue(
                                       listItemChangesRes.listitems.Changes.Id.ChangeTypeSpecified,
                                       @"The response of GetListItemChangesSinceToken should have changeType value if the request contains invalid changeToken value.");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R1223
                this.Site.CaptureRequirementIfAreEqual<ChangeTypeEnum>(
                                        ChangeTypeEnum.InvalidToken,
                                        listItemChangesRes.listitems.Changes.Id.ChangeType,
                                        1223,
                                        @"[In GetListItemChangesSinceTokenResponse][If present condition meet][The attribute]Changes.Id.ChangeType is contained within GetListItemChangesSinceTokenResponse.GetListItemChangesSinceTokenResult.listitems, as specified by [MS-LISTSWS].");
            }
        }
        /// <summary>
        /// This operation is used to retrieve details about list items in a list that satisfy specified criteria.
        /// </summary>
        /// <param name="listName">The name of the list from which item changes will be got</param>
        /// <param name="viewName">The GUID refers to a view of the list</param>
        /// <param name="query">The query to determine which records from the list are to be returned </param>
        /// <param name="viewFields">Specifies which fields of the list item should be returned</param>
        /// <param name="rowLimit">Specifies the maximum number of rows of data to return in the response</param>
        /// <param name="queryOptions">Specifies various options for modifying the query</param>
        /// <param name="webID">The GUID of the site that contains the list. If not specified, the default Web site based on the SOAP request is used</param>
        /// <returns>Get list item result</returns>
        public GetListItemsResponseGetListItemsResult GetListItems(string listName, string viewName, GetListItemsQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string webID)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            GetListItemsResponseGetListItemsResult result = null;
            try
            {
                result = this.listsProxy.GetListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID);

                // Verify the requirements of the GetListItems operation.
                this.VerifyGetListItemsOperation(result, queryOptions, viewFields);

                // Verify the requirements of the transport.
                this.VerifyTransportRequirements();
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }

            return result;
        }
 /// <remarks/>
 public void GetListItemChangesWithKnowledgeAsync(string listName, string viewName, GetListItemChangesWithKnowledgeQuery query, CamlViewFields viewFields, string rowLimit, CamlQueryOptions queryOptions, string syncScope, GetListItemChangesWithKnowledgeKnowledge knowledge, CamlContains contains)
 {
     this.GetListItemChangesWithKnowledgeAsync(listName, viewName, query, viewFields, rowLimit, queryOptions, syncScope, knowledge, contains, null);
 }