public void FieldCountTest1() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), false)) { CsvReaderSampleData.CheckSampleData1(csv, true); } }
public void ParsingTest37() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), false)) { csv.SupportsMultiline = false; CsvReaderSampleData.CheckSampleData1(csv, true); } }
public void IndexerTest1() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { for (int i = 0; i < CsvReaderSampleData.SampleData1RecordCount; i++) { string s = csv[i, 0]; CsvReaderSampleData.CheckSampleData1(i, csv); } } }
public void MoveToTest1() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { for (int i = 0; i < CsvReaderSampleData.SampleData1RecordCount; i++) { csv.MoveTo(i); CsvReaderSampleData.CheckSampleData1(i, csv); } } }
public void IterationTest1() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { int index = 0; foreach (string[] record in csv) { CsvReaderSampleData.CheckSampleData1(csv.HasHeaders, index, record); index++; } } }
public void Checkdata5(int bufferSize) { const string data = CsvReaderSampleData.SampleData1; try { using (CsvReader csv = new CsvReader(new StringReader(data), true, bufferSize)) { CsvReaderSampleData.CheckSampleData1(csv, true); } } catch (Exception ex) { throw new Exception(string.Format("BufferSize={0}", bufferSize), ex); } }
public void IndexerByFieldIndexTest() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { IDataReader reader = csv; string[] values = new string[CsvReaderSampleData.SampleData1RecordCount]; while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { values[i] = (string)reader[i]; } CsvReaderSampleData.CheckSampleData1(csv.HasHeaders, csv.CurrentRecordIndex, values); } } }
public void IndexerByFieldNameTest() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { IDataReader reader = csv; string[] values = new string[CsvReaderSampleData.SampleData1RecordCount]; while (reader.Read()) { values[0] = (string)reader[CsvReaderSampleData.SampleData1Header0]; values[1] = (string)reader[CsvReaderSampleData.SampleData1Header1]; values[2] = (string)reader[CsvReaderSampleData.SampleData1Header2]; values[3] = (string)reader[CsvReaderSampleData.SampleData1Header3]; values[4] = (string)reader[CsvReaderSampleData.SampleData1Header4]; values[5] = (string)reader[CsvReaderSampleData.SampleData1Header5]; CsvReaderSampleData.CheckSampleData1(csv.HasHeaders, csv.CurrentRecordIndex, values); } } }
public void GetValuesTest() { using (CsvReader csv = new CsvReader(new StringReader(CsvReaderSampleData.SampleData1), true)) { IDataReader reader = csv; object[] objValues = new object[CsvReaderSampleData.SampleData1RecordCount]; string[] values = new string[CsvReaderSampleData.SampleData1RecordCount]; while (reader.Read()) { Assert.AreEqual(CsvReaderSampleData.SampleData1RecordCount, reader.GetValues(objValues)); for (int i = 0; i < reader.FieldCount; i++) { values[i] = (string)objValues[i]; } CsvReaderSampleData.CheckSampleData1(csv.HasHeaders, csv.CurrentRecordIndex, values); } } }