public void ShouldEscapeunicodeCharacters() { string json = JsonStringBuilder.Escape("C:\\p"); Assert.AreEqual("C:\\\\p", json); Assert.That(JsonStringBuilder.Escape("data \"67676\""), Is.EqualTo("data \\\"67676\\\"")); }
public void ShouldEscapeJsonStructuralCharacters() { string escaped = JsonStringBuilder.Escape("\r\n\r\n"); Assert.AreEqual("\\r\\n\\r\\n", escaped); escaped = JsonStringBuilder.Escape("escape:\r\n\r\n"); Assert.AreEqual("escape:\\r\\n\\r\\n", escaped); escaped = JsonStringBuilder.Escape("escape:\b\f\r\n\t"); Assert.AreEqual("escape:\\b\\f\\r\\n\\t", escaped); }