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); } }
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)); } }
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); } }