/// <summary>
        /// parses the current position in the xml reader and fills
        /// the provided GDataFeedBatch property on the feed object
        /// </summary>
        /// <param name="reader">the xmlreader positioned at a batch element</param>
        /// <param name="feed">the atomfeed object to fill in</param>
        protected void ParseBatch(XmlReader reader, AtomFeed feed)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (feed == null)
            {
                throw new ArgumentNullException("feed");
            }

            if (IsCurrentNameSpace(reader, BaseNameTable.gBatchNamespace))
            {
                object elementName = reader.LocalName;

                if (feed.BatchData == null)
                {
                    feed.BatchData = new GDataBatchFeedData();
                }

                GDataBatchFeedData batch = feed.BatchData;

                if (elementName.Equals(this.nameTable.BatchOperation))
                {
                    batch.Type = (GDataBatchOperationType)Enum.Parse(typeof(GDataBatchOperationType),
                                                                     reader.GetAttribute(BaseNameTable.XmlAttributeType), true);
                }
                else
                {
                    Tracing.TraceInfo("got an unknown batch element: " + elementName.ToString());
                    reader.Skip();
                }
            }
        }
 public void TypeTest()
 {
     GDataBatchFeedData target = new GDataBatchFeedData(); // TODO: Initialize to an appropriate value
     GDataBatchOperationType expected = GDataBatchOperationType.insert;
     GDataBatchOperationType actual;
     target.Type = expected;
     actual = target.Type;
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
 public void BatchDataTest()
 {
     AtomFeed target = new AtomFeed(new Uri("http://www.test.com/"), null); 
     GDataBatchFeedData expected = new GDataBatchFeedData(); 
     GDataBatchFeedData actual;
     target.BatchData = expected;
     actual = target.BatchData;
     Assert.AreEqual(expected, actual);
 }
 public void GDataBatchFeedDataConstructorTest()
 {
     GDataBatchFeedData target = new GDataBatchFeedData();
     Assert.IsNotNull(target);
     Assert.IsTrue(target.Type == GDataBatchOperationType.Default);
 }