예제 #1
0
        public void GetSchemaTableTest()
        {
            var s = new StringBuilder();

            s.AppendLine("Id,Name");
            s.AppendLine("1,one");
            s.AppendLine("2,two");
            using (var reader = new StringReader(s.ToString()))
                using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
                {
                    var dataReader = new CsvDataReader(csv);

                    var schemaTable = dataReader.GetSchemaTable();
                    Assert.Equal(25, schemaTable.Columns.Count);
                    Assert.Equal(2, schemaTable.Rows.Count);
                }
        }
예제 #2
0
        public void GetSchemaTableTest()
        {
            var s = new StringBuilder();

            s.AppendLine("Id,Name");
            s.AppendLine("1,one");
            s.AppendLine("2,two");
            using (var reader = new StringReader(s.ToString()))
                using (var csv = new CsvReader(reader))
                {
                    csv.Configuration.Delimiter = ",";
                    var dataReader = new CsvDataReader(csv);

                    var schemaTable = dataReader.GetSchemaTable();
                    Assert.AreEqual(25, schemaTable.Columns.Count);
                    Assert.AreEqual(2, schemaTable.Rows.Count);
                }
        }