Пример #1
0
        public async Task ReadManifestAsync()
        {
            var setting = ManifestData.ReadManifestFileSystem(UnitTestInitializeCsv.GetTestPath("training_relation.manifest.json"));

            Assert.AreEqual(false, setting.HasFieldHeader);
            Assert.AreEqual(19, setting.Columns.Count());
            using (var reader = new CsvFileReader(setting.CsvFile(), null))
            {
                await reader.OpenAsync(UnitTestInitializeCsv.Token);

                Assert.AreEqual("object_id", reader.GetColumn(0).Name);
                reader.Read();
            }
        }
Пример #2
0
        public async Task ReadManifestZip()
        {
            var setting = ManifestData.ReadManifestZip(UnitTestInitializeCsv.GetTestPath("ces_xxx_v879548171_lo_exempt_status_reason_approver_local_full.zip"));

            Assert.AreEqual(false, setting.HasFieldHeader);
            Assert.AreEqual(3, setting.Columns.Count());
            using (var reader = new CsvFileReader(setting.CsvFile(), null))
            {
                await reader.OpenAsync(UnitTestInitializeCsv.Token);

                Assert.AreEqual("lesrlA_reason_id", reader.GetColumn(0).Name);
                reader.Read();
                Assert.AreEqual("Other", reader.GetValue(1));
            }
        }
Пример #3
0
        public void CsvDataReaderOpenDetailSkipRows()
        {
            var setting = new CsvFile
            {
                FileName       = Path.Combine(m_ApplicationDirectory, "BasicCSV.txt"),
                HasFieldHeader = false,
                SkipRows       = 1
            };

            setting.FileFormat.FieldDelimiter = ",";
            using (var test = new CsvFileReader(setting))
            {
                test.Open(true, CancellationToken.None);
                Assert.AreEqual(1, test.GetColumn(0).Size);
                Assert.AreEqual(7, test.GetColumn(1).Size, "LangCodeID");
                Assert.AreEqual(10, test.GetColumn(2).Size, "ExamDate");
                Assert.AreEqual(3, test.GetColumn(3).Size, "Score");
                Assert.AreEqual(5, test.GetColumn(4).Size, "Proficiency");
                Assert.AreEqual(1, test.GetColumn(5).Size, "IsNativeLang");
            }
        }