public void ParseSingleQualifiedColumn()
        {
            RowData     rowData   = new RowData();
            IFileReader reader    = FileReaderTest.GetReader("\"A,B\r\n\",C\r\n1,2,3");
            RowParser   rowParser = new RowParser(string.Empty, "\r\n", "\"");

            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, "\"A,B\r\n\",C\r\n", new string[] { "A,B\r\n,C" });
            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, "1,2,3", new string[] { "1,2,3" });
        }
        public void ParseSimpleRows()
        {
            RowData     rowData   = new RowData();
            IFileReader reader    = FileReaderTest.GetReader("A,B,C\r\n1,2,3");
            RowParser   rowParser = new RowParser(",", "\r\n", string.Empty);

            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, "A,B,C\r\n", new string[] { "A", "B", "C" });
            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, "1,2,3", new string[] { "1", "2", "3" });
        }
        public void ParseRowsWithUnevenFields()
        {
            RowData     rowData   = new RowData();
            IFileReader reader    = FileReaderTest.GetReader("A,B,C,D\r\n1,2,3");
            RowParser   rowParser = new RowParser(",", "\r\n", "\"");

            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, new string[] { "A", "B", "C", "D" });
            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, new string[] { "1", "2", "3" });
        }
        public void ParseQualifiedRowsWithError()
        {
            RowData     rowData   = new RowData();
            IFileReader reader    = FileReaderTest.GetReader("A,\"B\" \r\n1,2,3");
            RowParser   rowParser = new RowParser(",", "\r\n", "\"");

            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, new string[] { "A", "B " });
            rowParser.ParseNextRow(reader, rowData);
            RowDataTest.VerifyParsedRow(rowData, new string[] { "1", "2", "3" });
        }
        public void ParseNextRowBadReaderTest()
        {
            RowData   rowData = new RowData();
            RowParser target  = new RowParser(string.Empty, ",", string.Empty);

            target.ParseNextRow(null, rowData);
        }
        public void ParseRowWithTooManyColumns()
        {
            RowData rowData = new RowData();
            // It will repeat the given string up to 8000 characters nad that
            // will pass the maximum number of columns.
            IFileReader reader    = new FileReaderTestImpl("ABC,", 2000 * 4);
            RowParser   rowParser = new RowParser(",", "\r\n", string.Empty);

            rowParser.ParseNextRow(reader, rowData);
        }