public void NewLine() { // Arrange string[] data = { "asdf", "wxyz", "qwerty" + Environment.NewLine }; Stream stream = new MemoryStream(); string expected = "asdf,wxyz,\"qwerty" + Environment.NewLine + "\"" + Environment.NewLine; CsvStreamWriter writer = new CsvStreamWriter(stream); // Act writer.WriteRecord(data); writer.Flush(); stream.Position = 0; string result = new StreamReader(stream).ReadToEnd(); // Assert Assert.AreEqual(expected, result); }