Ejemplo n.º 1
0
        public void NullValuesShouldBeEmptyStrings()
        {
            var sut    = new CSVFormatter();
            var result = sut.FormatLine(new List <string>
            {
                "value a",
                null,
                "value c"
            });

            result.ShouldBe("value a,,value c");
        }
Ejemplo n.º 2
0
        public void LineFeedValuesShouldBeSurroundedWithQuotes()
        {
            var sut    = new CSVFormatter();
            var result = sut.FormatLine(new List <string>
            {
                "value a",
                "value b",
                "value c",
                "value d\rvalue e\rvalue f"
            });

            result.ShouldBe("value a,value b,value c,\"value d\rvalue e\rvalue f\"");
        }
Ejemplo n.º 3
0
        public void CommaValuesShouldBeSurroundedWithQuotes()
        {
            var sut    = new CSVFormatter();
            var result = sut.FormatLine(new List <string>
            {
                "value a",
                "value,b",
                "value c",
                "value d"
            });

            result.ShouldBe("value a,\"value,b\",value c,value d");
        }
Ejemplo n.º 4
0
        public void QuotedValuesShouldBeSurroundedWithQuotes()
        {
            var sut    = new CSVFormatter();
            var result = sut.FormatLine(new List <string>
            {
                "value a",
                "\"value b\"",
                "value\"c",
                "value d"
            });

            result.ShouldBe("value a,\"\"\"value b\"\"\",\"value\"\"c\",value d");
        }
Ejemplo n.º 5
0
        public void NormalValuesShouldBeCommaDelimited()
        {
            var sut    = new CSVFormatter();
            var result = sut.FormatLine(new List <string>
            {
                "value a",
                "value b",
                "value c",
                "value d"
            });

            result.ShouldBe("value a,value b,value c,value d");
        }