コード例 #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");
        }
コード例 #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\"");
        }
コード例 #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");
        }
コード例 #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");
        }
コード例 #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");
        }