示例#1
0
        public async Task OpenJsonArray()
        {
            var setting =
                new CsvFile(UnitTestInitializeCsv.GetTestPath("Larger.json.gz"))
            {
                JsonFormat = true
            };

            using (var dpd = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
                using (var jfr = new JsonFileReader(setting, dpd))
                {
                    await jfr.OpenAsync(dpd.CancellationToken);

                    Assert.AreEqual("object_id", jfr.GetName(0));
                    Assert.AreEqual("_last_touched_dt_utc", jfr.GetName(1));

                    await jfr.ReadAsync(dpd.CancellationToken);

                    Assert.AreEqual("ef21069c-3d93-4e07-878d-00e820727f65", jfr.GetString(0));
                    Assert.IsTrue((new DateTime(2020, 04, 03, 20, 45, 29, DateTimeKind.Local) - (DateTime)jfr.GetValue(1))
                                  .TotalSeconds < 1f);
                }
        }