示例#1
0
        public void WriteRead_WriteTwoRows_ReadsTwoRows()
        {
            _writer.Write("r1c1", "r1c2", "r1c3");
             _writer.Write("r2c1", "r2c2");

             _ms.Flush();
             _ms.Position = 0;

             _reader = new CsvReader(_ms, Encoding.UTF8);
             string[] r1 = _reader.ReadNextRow().ToArray();
             string[] r2 = _reader.ReadNextRow().ToArray();
             var r3 = _reader.ReadNextRow();

             Assert.Null(r3);
             Assert.Equal(2, r2.Length);
             Assert.Equal(3, r1.Length);

             Assert.Equal("r2c1", r2[0]);
        }
示例#2
0
 public CsvReaderWriterTest()
 {
     _ms = new MemoryStream();
      _writer = new CsvWriter(_ms, Encoding.UTF8);
      _reader = new CsvReader(_ms, Encoding.UTF8);
 }