This commit is contained in:
James Newton-King
2014-09-25 21:04:24 +12:00
parent 2faf5059bf
commit 6a22345e28
5 changed files with 38 additions and 13 deletions
@@ -580,6 +580,21 @@ namespace Newtonsoft.Json.Tests
Assert.AreEqual(@"""It's a good day\r\n\""sunshine\""""", json);
}
[Test]
public void ToStringStringEscapeHandling()
{
string v = "<b>hi " + '\u20AC' + "</b>";
string json = JsonConvert.ToString(v, '"');
Assert.AreEqual(@"""<b>hi " + '\u20AC' + @"</b>""", json);
json = JsonConvert.ToString(v, '"', StringEscapeHandling.EscapeHtml);
Assert.AreEqual(@"""\u003cb\u003ehi " + '\u20AC' + @"\u003c/b\u003e""", json);
json = JsonConvert.ToString(v, '"', StringEscapeHandling.EscapeNonAscii);
Assert.AreEqual(@"""<b>hi \u20ac</b>""", json);
}
[Test]
public void WriteDateTime()
{
@@ -182,7 +182,7 @@ namespace Newtonsoft.Json.Tests
[Test]
public void DeserializeLargeJson()
{
for (int i = 0; i < 100; i++)
for (int i = 0; i < 5; i++)
{
using (var fs = System.IO.File.OpenText("large.json"))
using (JsonTextReader jsonTextReader = new JsonTextReader(fs))