Beispiel #1
0
 protected CsvLoaderBase(string fileName, char delimeter = ';')
 {
     Reader = new CsvReader(new StreamReader(fileName, Encoding.GetEncoding(1251)), false, delimeter);
 }
Beispiel #2
0
 public void MetaTest_CsvWithDifferentFieldCount()
 {
     /*
     1;2
     1;2;3;4
     1;2;3
      */
     var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Meta", "001.csv");
     var reader = new CsvReader(new StreamReader(fileName, Encoding.GetEncoding(1251)), false, ';');
     reader.ReadNextRecord();
     Assert.AreEqual("1;2", String.Join(";", new[] { reader[0], reader[1] }));
     reader.ReadNextRecord();
     Assert.AreEqual("1;2;3;4", String.Join(";", new[] { reader[0], reader[1], reader[2], reader[3] }));
     reader.ReadNextRecord();
     Assert.AreEqual("1;2;3", String.Join(";", new[] { reader[0], reader[1], reader[2]}));
 }