Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Verify the message syntax of GetListItemChanges operation when the response is 
        /// received successfully.
        /// </summary>
        /// <param name="getListItemChangesResult">The result of the operation</param>
        private void VerifyGetListItemChangesOperation(
            GetListItemChangesResponseGetListItemChangesResult getListItemChangesResult)
        {
            Site.Assert.IsNotNull(getListItemChangesResult, "The getListItemChangesResult must be not null.");

            // Verify R1845
            // 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(
                1845,
                @"[The schema of GetListItemChanges is defined as:]"
                + @"<wsdl:operation name=""GetListItemChanges"">"
                + @"    <wsdl:input message=""GetListItemChangesSoapIn"" />"
                + @"    <wsdl:output message=""GetListItemChangesSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R628
            // 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(
                628,
                @"[In GetListItemChanges operation] [If the protocol client sends a "
                + "GetListItemChangesSoapIn request message] the protocol server responds "
                + "with a GetListItemChangesSoapOut response message.");

            // Verify R1850
            // 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(
                1850,
                @"[GetListItemChangesSoapOut]The SOAP Body contains a "
                + "GetListItemChangesResponse element.");

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

            // Verify R1856
            // 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(
                1856,
                @"[The schema of GetListItemChangesResponse is defined as:] "
                + @"<s:element minOccurs=""0"" maxOccurs=""1"" name=""GetListItemChangesResult"">"
                + @"   <s:complexType mixed=""true"">"
                + @"    <s:sequence>"
                + @"      <s:element name=""GetListItemChangesResult"">"
                + @"        <s:complexType>"
                + @"          <s:sequence>"
                + @"            <s:element name=""listitems"" >"
                + @"              <s:complexType mixed=""true"" >"
                + @"                <s:sequence>"
                + @"                  <s:any />                "
                + @"                </s:sequence>"
                + @"              <s:Attribute name=""TimeStamp"" type=""s:string""/>"
                + @"              </s:complexType>"
                + @"            </s:element>"
                + @"          </s:sequence>"
                + @"        </s:complexType>"
                + @"      </s:element>"
                + @"    </s:sequence>"
                + @"  </s:complexType>"
                + @"</s:element>");

            // Verify R1857
            // When the index of the <s:schema> element is equal to -1, which 
            // means the element is excluded, then the following requirement can be captured
            this.Site.Assert.IsNotNull(getListItemChangesResult.listitems, "listitems element should not be null.");

            // There can be a maximum of two rs:data elements
            if (null != getListItemChangesResult.listitems.data && getListItemChangesResult.listitems.data.Length <= 2)
            {
                bool isunExpectedelementExisting = false;
                foreach (DataDefinition dataElemt in getListItemChangesResult.listitems.data)
                {
                    if (null != dataElemt.Any)
                    {
                        XmlNode[] rowdatas = dataElemt.Any;

                        // verify whether exiting a "<s:schema>" under listitems element
                        isunExpectedelementExisting = rowdatas.Any(founder => (founder.OuterXml.IndexOf(
                                                            "<s:schema>",
                                                             StringComparison.OrdinalIgnoreCase) >= 0));
                    }

                    if (isunExpectedelementExisting)
                    {
                        break;
                    }
                }

                // if there is no "<s:schema>" element existing, capture R1587
                Site.CaptureRequirementIfIsFalse(
                    isunExpectedelementExisting,
                    1857,
                    @"[GetListItemChangesResponse]GetListItemChangesResult: 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 R2163
            // 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(
                2163,
                @"[In GetListItemChanges operation] [In GetListItemChangesResponse element]"
                + "The listitems element includes attributes describing the namespaces for the "
                + "ADO 2.6 Persistence format.");

            // Verify R1858
            // 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(
                1858,
                @"[GetListItemChangesResponse] listitems contains an inner element named "
                + "rs:data, which is of type DataDefinition.");

            // Verify R1859
            // 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 
            DateTime dt = new DateTime();
            bool isVerifyR1859 = DateTime.TryParse(getListItemChangesResult.listitems.TimeStamp, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt);
            Site.CaptureRequirementIfIsTrue(
                isVerifyR1859,
                1859,
                @"[GetListItemChangesResponse]The TimeStamp attribute is a string that contains the "
                + "date in Coordinated Universal Time (UTC) of the request to the protocol server.");

            // Verify R1860
            // 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(
                1860,
                @"[GetListItemChangesResponse]There can be a maximum of two rs:data elements.");

            // Verify R1864
            // 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(
                1864,
                @"[GetListItemChangesResponse]Note that set of fields returned by the method is "
                + "restricted by the viewField parameter.");
        }
Exemplo n.º 3
0
        /// <summary>
        /// A method used to verify the response of GetListItemChanges operation whether contain at least one rs:data structure item under "listitems" element. If the response does not contain any rs:data item under "listitems" element, this method will throw Assert exception.
        /// </summary>
        /// <param name="listitemChangesRes">A parameter represents the response of GetListItemChangesSinceToken operation which expected to contain zrow data structure under "listitems" element.</param>
        protected void VerifyContainZrowDataStructure(GetListItemChangesResponseGetListItemChangesResult listitemChangesRes)
        {
            if (null == listitemChangesRes)
            {
                throw new ArgumentNullException("listitemChangesRes");
            }

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

            this.Site.Assert.IsTrue(
                            listitemChangesRes.listitems.data.Length > 0,
                            "The response of GetListItemChanges operation should contain at least one rs:data element.");

            // There can be a maximum of two rs:data elements. The first rs:data element contains all the inserted and updated list items that have occurred subsequent to the specified since parameter. The second rs:data element contains all of the list items currently in the list. 
            this.Site.Assert.IsTrue(
                            listitemChangesRes.listitems.data.Length <= 2,
                            "The response of GetListItemChanges operation should contain maximum of two rs:data elements.");
        }