Example #1
0
        public void AutoRemoveQuotes()
        {
            var       eng = new CsvEngine(new CsvOptions("YourClass", ',', 2, 0));
            DataTable dt  = eng.ReadFileAsDT(TestCommon.GetPath("Good", "QuoteMode1.txt"));

            Assert.AreEqual("VINET", dt.Rows[0][1]);
        }
Example #2
0
        public void AutoRemoveQuotes()
        {
            var eng = new CsvEngine(new CsvOptions("YourClass", ',', 2, 0));
            DataTable dt = eng.ReadFileAsDT(TestCommon.GetPath("Good", "QuoteMode1.txt"));

            Assert.AreEqual("VINET", dt.Rows[0][1]);
        }
        private void RunTest(string file, char delimiter, char delimiterHdr, string classname)
        {
            CsvOptions options = new CsvOptions(classname, delimiter, file);

            options.HeaderDelimiter = delimiterHdr;
            CsvEngine engine = new CsvEngine(options);

            Assert.AreEqual(classname, engine.RecordType.Name);

            DataTable dt = engine.ReadFileAsDT(file);

            Assert.AreEqual(20, dt.Rows.Count);
            Assert.AreEqual(20, engine.TotalRecords);
            Assert.AreEqual(0, engine.ErrorManager.ErrorCount);

            Assert.AreEqual("CustomerID", dt.Columns[0].ColumnName);
        }
        public void ReadFileHeader2()
        {
            string file = TestCommon.GetPath("Good", "RealCsvComma1.txt");
            string classname = "CustomerComma";
            char delimiter = ',';

            var options = new CsvOptions(classname, delimiter, file);
            options.HeaderLines = 2;

            var engine = new CsvEngine(options);

            Assert.AreEqual(classname, engine.RecordType.Name);

            DataTable dt = engine.ReadFileAsDT(file);

            Assert.AreEqual(19, dt.Rows.Count);
            Assert.AreEqual(19, engine.TotalRecords);
            Assert.AreEqual(0, engine.ErrorManager.ErrorCount);

            Assert.AreEqual("CustomerID", dt.Columns[0].ColumnName);
        }
        public void ReadFileHeader2()
        {
            string file      = TestCommon.GetPath("Good", "RealCsvComma1.txt");
            string classname = "CustomerComma";
            char   delimiter = ',';

            CsvOptions options = new CsvOptions(classname, delimiter, file);

            options.HeaderLines = 2;

            CsvEngine engine = new CsvEngine(options);

            Assert.AreEqual(classname, engine.RecordType.Name);

            DataTable dt = engine.ReadFileAsDT(file);

            Assert.AreEqual(19, dt.Rows.Count);
            Assert.AreEqual(19, engine.TotalRecords);
            Assert.AreEqual(0, engine.ErrorManager.ErrorCount);

            Assert.AreEqual("CustomerID", dt.Columns[0].ColumnName);
        }
        private void RunTest(string file, char delimiter, char delimiterHdr, string classname)
        {
            var options = new CsvOptions(classname, delimiter, file);
            options.HeaderDelimiter = delimiterHdr;
            var engine = new CsvEngine(options);

            Assert.AreEqual(classname, engine.RecordType.Name);

            DataTable dt = engine.ReadFileAsDT(file);

            Assert.AreEqual(20, dt.Rows.Count);
            Assert.AreEqual(20, engine.TotalRecords);
            Assert.AreEqual(0, engine.ErrorManager.ErrorCount);

            Assert.AreEqual("CustomerID", dt.Columns[0].ColumnName);
        }