-Changed portable assembly to .NET 4.5, Silverlight 5, Win8, WP8

-Fixed incorrect namespace when converting XML to JSON
This commit is contained in:
James Newton-King
2013-03-06 23:04:26 +13:00
parent f42a6ca001
commit 92de187a74
37 changed files with 235 additions and 84 deletions
@@ -44,6 +44,93 @@ namespace Newtonsoft.Json.Tests
[TestFixture]
public class JsonTextReaderTest : TestFixtureBase
{
[Test]
public void UnescapeDoubleQuotes()
{
string json = @"{""recipe_id"":""12"",""recipe_name"":""Apocalypse Leather Armors"",""recipe_text"":""#C16------------------------------\r\n#C12Ingredients #C20\r\n#C16------------------------------\r\n\r\na piece of Leather Armor\r\n( ie #L \""Enhanced Leather Armor Boots\"" \""85644\"" )\r\n<img src=rdb:\/\/13264>\r\n\r\n#L \""Hacker Tool\"" \""87814\""\r\n<img src=rdb:\/\/99282>\r\n\r\n#L \""Clanalizer\"" \""208313\""\r\n<img src=rdb:\/\/156479>\r\n\r\n#C16------------------------------\r\n#C12Recipe #C16\r\n#C16------------------------------#C20\r\n\r\nHacker Tool\r\n#C15+#C20\r\na piece of Leather Armor\r\n#C15=#C20\r\n<img src=rdb:\/\/13264>\r\na piece of Hacked Leather Armor\r\n( ie : #L \""Hacked Leather Armor Boots\"" \""245979\"" )\r\n#C16Skills: | BE |#C20\r\n\r\n#C14------------------------------#C20\r\n\r\nClanalizer\r\n#C15+#C20\r\na piece of Hacked Leather Armor\r\n#C15=#C20\r\n<img src=rdb:\/\/13264>\r\na piece of Apocalypse Leather Armor\r\n( ie : #L \""Apocalypse Leather Armor Boots\"" \""245966\"" )\r\n#C16Skills: | ?? |#C20\r\n\r\n#C16------------------------------\r\n#C12Details#C16\r\n#C16------------------------------#C20\r\n\r\n#L \""Apocalypse Leather Armor Boots\"" \""245967\""\r\n#L \""Apocalypse Leather Armor Gloves\"" \""245969\""\r\n#L \""Apocalypse Leather Armor Helmet\"" \""245975\""\r\n#L \""Apocalypse Leather Armor Pants\"" \""245971\""\r\n#L \""Apocalypse Leather Armor Sleeves\"" \""245973\""\r\n#L \""Apocalypse Leather Body Armor\"" \""245965\""\r\n\r\n#C16------------------------------\r\n#C12Comments#C16\r\n#C16------------------------------#C20\r\n\r\nNice froob armor.. but ugleh!\r\n\r\n"",""recipe_author"":null}";
JsonTextReader reader = new JsonTextReader(new StringReader(json));
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.AreEqual("recipe_text", reader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.AreEqual(@"#C16------------------------------
#C12Ingredients #C20
#C16------------------------------
a piece of Leather Armor
( ie #L ""Enhanced Leather Armor Boots"" ""85644"" )
<img src=rdb://13264>
#L ""Hacker Tool"" ""87814""
<img src=rdb://99282>
#L ""Clanalizer"" ""208313""
<img src=rdb://156479>
#C16------------------------------
#C12Recipe #C16
#C16------------------------------#C20
Hacker Tool
#C15+#C20
a piece of Leather Armor
#C15=#C20
<img src=rdb://13264>
a piece of Hacked Leather Armor
( ie : #L ""Hacked Leather Armor Boots"" ""245979"" )
#C16Skills: | BE |#C20
#C14------------------------------#C20
Clanalizer
#C15+#C20
a piece of Hacked Leather Armor
#C15=#C20
<img src=rdb://13264>
a piece of Apocalypse Leather Armor
( ie : #L ""Apocalypse Leather Armor Boots"" ""245966"" )
#C16Skills: | ?? |#C20
#C16------------------------------
#C12Details#C16
#C16------------------------------#C20
#L ""Apocalypse Leather Armor Boots"" ""245967""
#L ""Apocalypse Leather Armor Gloves"" ""245969""
#L ""Apocalypse Leather Armor Helmet"" ""245975""
#L ""Apocalypse Leather Armor Pants"" ""245971""
#L ""Apocalypse Leather Armor Sleeves"" ""245973""
#L ""Apocalypse Leather Body Armor"" ""245965""
#C16------------------------------
#C12Comments#C16
#C16------------------------------#C20
Nice froob armor.. but ugleh!
", reader.Value);
}
[Test]
public void SurrogatePairValid()
{