Ejemplo n.º 1
0
 public void UnprocessedTest()
 {
     GDataBatchInterrupt target = new GDataBatchInterrupt(); // TODO: Initialize to an appropriate value
     int expected = 5; // TODO: Initialize to an appropriate value
     int actual;
     target.Unprocessed = expected;
     actual = target.Unprocessed;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// parses the current position in the xml reader and fills
        /// the provided GDataEntryBatch property on the entry object
        /// </summary>
        /// <param name="reader">the xmlreader positioned at a batch element</param>
        /// <param name="entry">the atomentry object to fill in</param>
        protected void ParseBatch(XmlReader reader, AtomEntry entry)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

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

                if (entry.BatchData == null)
                {
                    entry.BatchData = new GDataBatchEntryData();
                }

                GDataBatchEntryData batch = entry.BatchData;

                if (elementName.Equals(this.nameTable.BatchId))
                {
                    batch.Id = Utilities.DecodedValue(reader.ReadString());
                }
                else if (elementName.Equals(this.nameTable.BatchOperation))
                {
                    batch.Type = ParseOperationType(reader);
                }
                else if (elementName.Equals(this.nameTable.BatchStatus))
                {
                    batch.Status = GDataBatchStatus.ParseBatchStatus(reader, this);
                }
                else if (elementName.Equals(this.nameTable.BatchInterrupt))
                {
                    batch.Interrupt = GDataBatchInterrupt.ParseBatchInterrupt(reader, this);
                }
                else
                {
                    Tracing.TraceInfo("got an unknown batch element: " + elementName.ToString());
                    // default extension parsing
                    ParseExtensionElements(reader, entry);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// parses a batchinterrupt element from a correctly positioned reader
        /// </summary>
        /// <param name="reader">XmlReader at the start of the element</param>
        /// <param name="parser">the feedparser to be used</param>
        /// <returns>GDataBatchInterrupt</returns>
        public static GDataBatchInterrupt ParseBatchInterrupt(XmlReader reader, AtomFeedParser parser)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            object localname = reader.LocalName;
            GDataBatchInterrupt interrupt = null;

            if (localname.Equals(parser.Nametable.BatchInterrupt))
            {
                interrupt = new GDataBatchInterrupt();
                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        localname = reader.LocalName;
                        if (localname.Equals(parser.Nametable.BatchReason))
                        {
                            interrupt.Reason = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(parser.Nametable.BatchSuccessCount))
                        {
                            interrupt.Successes = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }
                        else if (localname.Equals(parser.Nametable.BatchFailureCount))
                        {
                            interrupt.Failures = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }
                        else if (localname.Equals(parser.Nametable.BatchParsedCount))
                        {
                            interrupt.Parsed = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }
                        else if (localname.Equals(parser.Nametable.BatchUnprocessed))
                        {
                            interrupt.Unprocessed = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }
                    }
                }
            }
            return(interrupt);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// parses a batchinterrupt element from a correctly positioned reader
        /// </summary>
        /// <param name="reader">XmlReader at the start of the element</param>
        /// <returns>GDataBatchInterrupt</returns>
        protected GDataBatchInterrupt ParseBatchInterrupt(XmlReader reader)
        {
            object localname = reader.LocalName;
            GDataBatchInterrupt interrupt = null;
            if (localname.Equals(this.nameTable.BatchInterrupt))
            {
                interrupt = new GDataBatchInterrupt(); 
                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        localname = reader.LocalName;
                        if (localname.Equals(this.nameTable.BatchReason))
                        {
                            interrupt.Reason = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(this.nameTable.BatchSuccessCount))
                        {
                            interrupt.Successes = int.Parse(Utilities.DecodedValue(reader.Value)); 
                        }
                        else if (localname.Equals(this.nameTable.BatchFailureCount))
                        {
                            interrupt.Failures = int.Parse(Utilities.DecodedValue(reader.Value)); 
                        }
                        else if (localname.Equals(this.nameTable.BatchParsedCount))
                        {
                            interrupt.Parsed = int.Parse(Utilities.DecodedValue(reader.Value)); 
                        }
                        else if (localname.Equals(this.nameTable.BatchUnprocessed))
                        {
                            interrupt.Unprocessed= int.Parse(Utilities.DecodedValue(reader.Value)); 
                        }

                    }
                }
            }
            return interrupt; 

        }
Ejemplo n.º 5
0
 public void FailuresTest()
 {
     GDataBatchInterrupt target = new GDataBatchInterrupt(); // TODO: Initialize to an appropriate value
     int expected = 9; // TODO: Initialize to an appropriate value
     int actual;
     target.Failures = expected;
     actual = target.Failures;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 6
0
 public void ReasonTest()
 {
     GDataBatchInterrupt target = new GDataBatchInterrupt(); // TODO: Initialize to an appropriate value
     string expected = "TestValue";            
     string actual;
     target.Reason = expected;
     actual = target.Reason;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 7
0
 public void InterruptTest()
 {
     GDataBatchEntryData target = new GDataBatchEntryData(); // TODO: Initialize to an appropriate value
     GDataBatchInterrupt expected = new GDataBatchInterrupt();
     GDataBatchInterrupt actual;
     target.Interrupt = expected;
     actual = target.Interrupt;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// parses a batchinterrupt element from a correctly positioned reader
        /// </summary>
        /// <param name="reader">XmlReader at the start of the element</param>
        /// <param name="parser">the feedparser to be used</param>
        /// <returns>GDataBatchInterrupt</returns>
        public static GDataBatchInterrupt ParseBatchInterrupt(XmlReader reader, AtomFeedParser parser) {
            if (reader == null) {
                throw new ArgumentNullException("reader");
            }

            object localname = reader.LocalName;
            GDataBatchInterrupt interrupt = null;
            if (localname.Equals(parser.Nametable.BatchInterrupt)) {
                interrupt = new GDataBatchInterrupt();
                if (reader.HasAttributes) {
                    while (reader.MoveToNextAttribute()) {
                        localname = reader.LocalName;
                        if (localname.Equals(parser.Nametable.BatchReason)) {
                            interrupt.Reason = Utilities.DecodedValue(reader.Value);
                        } else if (localname.Equals(parser.Nametable.BatchSuccessCount)) {
                            interrupt.Successes = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        } else if (localname.Equals(parser.Nametable.BatchFailureCount)) {
                            interrupt.Failures = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        } else if (localname.Equals(parser.Nametable.BatchParsedCount)) {
                            interrupt.Parsed = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        } else if (localname.Equals(parser.Nametable.BatchUnprocessed)) {
                            interrupt.Unprocessed = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }

                    }
                }
            }
            return interrupt;
        }