Exemple #1
0
 public void WhenFieldIsInQuotes_AndContainsOneQuoteAloneAndNotAtEndOfField_ThrowsCsvException()
 {
     using (var rowReader = new CsvRowReader("\"Hello \"World\"".ToStream(), Encoding.UTF8, ',', '"'))
     {
         var ex = Assert.Throws <CsvException>(() => rowReader.First());
         Assert.Equal(8, ex.Position);
     }
 }
Exemple #2
0
 public void WhenLeftHandFieldIsEmpty_ReturnsEmptyField()
 {
     using (var rowReader = new CsvRowReader(",World".ToStream(), Encoding.UTF8, ',', '"'))
     {
         Assert.Collection(rowReader.First().Fields, x => Assert.Equal("", x),
                           x => Assert.Equal("World", x));
     }
 }
Exemple #3
0
 public void GivenFieldIsNotInQuotes_WhenItContainsAQuote_ThrowsCsvException()
 {
     using (var rowReader = new CsvRowReader("Hello \"World".ToStream(), Encoding.UTF8, ',', '"'))
     {
         var ex = Assert.Throws <CsvException>(() => rowReader.First());
         Assert.Equal(7, ex.Position);
     }
 }