Exemple #1
0
        public void GetElementsFromBodyTest_NoServiceQuery()
        {
            Message originalMessage;
            Message message;

            originalMessage = message = GetSampleMessage(false);
            ServiceQuery serviceQuery = MessageUtility.GetServiceQuery(ref message);

            // no service query
            Assert.AreEqual(null, serviceQuery, "service query not null");

            // the message did not change, it should compare
            XmlDictionaryReader reader = MessageUtilityTest.CreateReaderFromMessage(message);

            MessageUtilityTest.CompareSampleMessage(reader);

            // cleanup
            reader.Close();
            originalMessage.Close();
        }
Exemple #2
0
        public void GetElementsFromBodyTest_WithServiceQuery()
        {
            Message originalMessage;
            Message message;

            originalMessage = message = GetSampleMessage(true);
            ServiceQuery serviceQuery = MessageUtility.GetServiceQuery(ref message);

            Assert.IsNotNull(serviceQuery);
            Assert.AreEqual(2, serviceQuery.QueryParts.Count());
            ServiceQueryPart[] parts = serviceQuery.QueryParts.ToArray();
            Assert.AreEqual(parts[0].ToString(), @"where=(it.City.StartsWith(""R"")&&(it.AddressID<400))");
            Assert.AreEqual(parts[1].ToString(), "orderby=it.AddressId");
            Assert.AreEqual(true, serviceQuery.IncludeTotalCount);
            Assert.AreEqual(2, serviceQuery.QueryParts.Count());

            XmlDictionaryReader reader = MessageUtilityTest.CreateReaderFromMessage(message);

            MessageUtilityTest.CompareSampleMessage(reader);

            // cleanup
            reader.Close();
            originalMessage.Close();
        }