public void DisposeReader()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     Assert.AreEqual(reader.IsClosed, false);
     reader.Close();
     reader.Dispose();
     reader.Dispose();
 }
 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"));
     reader.Dispose();
 }
 public void EmbeddedComma()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     reader.Read();
     reader.Read();
     Assert.AreEqual(reader.GetValue(0).ToString(), "Quotes");
     string v1 = reader.GetValue(2).ToString();
     string expected = "Q,A";
     Assert.AreEqual(expected, v1);
     reader.Dispose();
 }
        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();
            reader.Dispose();
        }
 public void GetOrdinal()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     Assert.AreEqual(0, reader.GetOrdinal("Header1"));
     reader.Dispose();
 }
 public void FieldCount()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     Assert.AreEqual(3, reader.FieldCount);
     reader.Dispose();
 }
 public void SimpleOpen()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     reader.Dispose();
 }
 public void ReadAllRows()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     while (reader.Read())
     {
     }
     reader.Close();
     reader.Dispose();
 }
        public void MoveFile()
        {
            CsvDataReader reader = new CsvDataReader(@"..\..\MoveCsv.txt");
            Assert.AreEqual(reader.IsClosed, false);
            reader.Close();
            Assert.AreEqual(reader.IsClosed, true);
            reader.Dispose();

            File.Move(@"..\..\MoveCsv.txt", @"..\..\MoveCsvTemp.txt");
            File.Move(@"..\..\MoveCsvTemp.txt", @"..\..\MoveCsv.txt");
        }
 public void GetValue()
 {
     CsvDataReader reader = new CsvDataReader(@"..\..\SimpleCsv.txt");
     reader.Read();
     string v1 = reader.GetValue(0).ToString();
     Assert.AreEqual("Row1A", v1);
     Assert.AreEqual("Row1B", reader.GetValue(1).ToString());
     reader.Dispose();
 }