示例#1
0
        public void ChannelDataReader_can_Read_ChannelSet_Data()
        {
            var reader = new ChannelDataReader(ChannelSetData);
            var json   = new StringBuilder("[");
            int count  = 0;

            Assert.AreEqual(2, reader.Depth);
            Assert.AreEqual(5, reader.FieldCount);
            Assert.AreEqual(5, reader.RecordsAffected);
            json.AppendLine();

            while (reader.Read())
            {
                Console.WriteLine("Row {0}: {1}, {2}, {3}, {4}, {5}", count++,
                                  reader.GetDouble(0),
                                  reader.GetDateTimeOffset(1),
                                  reader.GetString(2),
                                  reader.GetDouble(3),
                                  reader.GetDouble(4));

                json.AppendLine(reader.GetJson());
            }

            Assert.IsNull(reader.GetJson());

            // original
            Console.WriteLine();
            Console.WriteLine(ChannelSetData);

            // serialized
            Console.WriteLine();
            Console.WriteLine(json.Append("]"));
        }