コード例 #1
0
        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" });
        }
コード例 #2
0
 private void InitializeDataRowParsing()
 {
     this.rowParser = new RowParser(this.columnDelimiter, this.rowDelimiter, this.textQualifier);
 }
コード例 #3
0
 public void ParseNextRowBadReaderTest()
 {
     RowData rowData = new RowData();
     RowParser target = new RowParser(string.Empty, ",", string.Empty);
     target.ParseNextRow(null, rowData);
 }
コード例 #4
0
        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" });
        }
コード例 #5
0
 public void RowParserBuilderArgumentsTest()
 {          
     RowParser target = new RowParser(null, null, null);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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" });
        }
コード例 #8
0
        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" });
        }
コード例 #9
0
 private void InitializeDataRowParsing()
 {
     this.rowParser = new RowParser(this.columnDelimiter, this.rowDelimiter, this.textQualifier);
 }