public void TestWriteLine() { var encoding = new UTF8Encoding(false); // UTF-8 BOM must die !! var bean = new SampleBean() { Column1 = "value1", Column2 = "value\nvalue,value\"", MyNumber = 1234 }; using (var stream = new MemoryStream()) using (var instance = new CSVWriter <SampleBean>(stream, encoding)) { instance.WriteLine(bean); instance.Flush(); var result = encoding.GetString(stream.ToArray()); var expected = "value1,\"value\nvalue,value\"\"\",1234\r\n"; Check.That(result).IsEqualTo(expected); } }
private void AssertMethodInvocation(SampleBean bean, string methodName) { Assert.True(bean.Invocations[methodName]); }