Example #1
0
        public void WriteNoFields()
        {
            var sw     = new StringWriter();
            var writer = new CsvRowWriter(sw);

            writer.Write(new string[] { });
            writer.Write(new string[] { });

            Assert.AreEqual("\r\n\r\n", sw.ToString());
        }
Example #2
0
        public void WriteEmpty()
        {
            var sw     = new StringWriter();
            var writer = new CsvRowWriter(sw);

            writer.Write(new[] { "", "", "" });
            writer.Write(new string [] { null, null, null });

            Assert.AreEqual(",,\r\n,,\r\n", sw.ToString());
        }
Example #3
0
        public void Write()
        {
            var sw     = new StringWriter();
            var writer = new CsvRowWriter(sw);

            writer.Write(new[] { "aaa", "aaa", "aaa" });
            writer.Write(new[] { "bbb", "bbb", "bbb" });

            Assert.AreEqual("aaa,aaa,aaa\r\nbbb,bbb,bbb\r\n", sw.ToString());
        }
Example #4
0
        public void WriteEscape()
        {
            var sw     = new StringWriter();
            var writer = new CsvRowWriter(sw);

            writer.Write(new[] { ",", "a,", "\r", "\n", "\"" });
            // ",","a,","\r","\n",""""
            Assert.AreEqual("\",\",\"a,\",\"\r\",\"\n\",\"\"\"\"\r\n", sw.ToString());
        }