public void CaseInsensitiveColumnNames() { CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt"); Assert.AreEqual(0, reader.GetOrdinal("header1")); Assert.AreEqual(1, reader.GetOrdinal("HEADER2")); Assert.AreEqual(2, reader.GetOrdinal("HeaDER3")); }
public void AddStaticValue() { Dictionary<String, String> staticColumns = new Dictionary<String, String>(); staticColumns.Add("Column1", "Value"); CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt", staticColumns); Assert.AreEqual(3, reader.GetOrdinal("Column1")); while (reader.Read()) { Assert.AreEqual("Value", reader.GetValue(reader.GetOrdinal("Column1"))); } reader.Close(); }
public void HeadersParse() { CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt"); Assert.AreEqual(0, reader.GetOrdinal("Header1")); Assert.AreEqual(1, reader.GetOrdinal("Header2")); Assert.AreEqual(2, reader.GetOrdinal("Header3")); }
public void GetOrdinalFailure() { CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt"); int i = reader.GetOrdinal("ZZZZ"); //Assert.Fail(); }
public void GetOrdinal() { CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt"); Assert.AreEqual(0, reader.GetOrdinal("Header1")); }
public void GetOrdinalFailure() { using (CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt")) { int i = reader.GetOrdinal("ZZZZ"); } //Assert.Fail(); //reader.Dispose(); }