예제 #1
0
        public void TestCsvWriterEmpty()
        {
            StringWriter  stringWriter  = new StringWriter();
            CSVFileWriter csvFileWriter = new CSVFileWriter(stringWriter);
            DataTable     dataTable     = new DataTable();

            csvFileWriter.WriteFromDataTable(dataTable);
            csvFileWriter.Close();
            Assert.AreEqual(Environment.NewLine, stringWriter.ToString());
        }
예제 #2
0
        public void TestCsvWriterCommasInHeader()
        {
            StringWriter  stringWriter  = new StringWriter();
            CSVFileWriter csvFileWriter = new CSVFileWriter(stringWriter);
            DataTable     dataTable     = CsvTestsSamples.CommasInHeaderDataTable();

            csvFileWriter.WriteFromDataTable(dataTable);
            csvFileWriter.Close();
            string expected = CsvTestsSamples.CommasInHeaderCsvContents();

            Assert.AreEqual(expected, stringWriter.ToString());
        }