public void DoubleQuotesAreEscapedOnSerializing()
        {
            typeof(EscapeTest).IsPublic.Should().BeTrue();
            EscapeTest obj = new EscapeTest {
                Name = "Tony \"Iron Man\" Stark"
            };
            string csv = CsvSerializer.Serialize(new[] { obj });

            csv.Should().Be("\"Tony \"\"Iron Man\"\" Stark\"");
        }
Example #2
0
        public void DoubleQuotesAreUnescapedOnDeserializing()
        {
            typeof(EscapeTest).IsPublic.Should().BeFalse();
            string csv = "\"Tony \"\"Iron Man\"\" Stark\"";

            EscapeTest[] items = CsvSerializer.Deserialize <EscapeTest>(csv);
            items.Length.Should().Be(1);
            EscapeTest item = items[0];

            item.Name.Should().Be("Tony \"Iron Man\" Stark");
        }