-Added DeserializeAnonymousType overload with JsonSerializerSettings

-Added support for specifying the root type when serialize JSON to use with TypeNameHandling.Auto
-Fixed recursively reading type wrapper objects when deserializing
This commit is contained in:
James Newton-King
2013-02-23 22:09:51 -08:00
parent 159c5ee8cd
commit f9fa0b00e7
10 changed files with 177 additions and 10 deletions
@@ -1266,6 +1266,36 @@ bye", reader.Value);
Assert.IsFalse(jsonReader.Read());
}
[Test]
public void ReadOctalNumberAsInt64()
{
StringReader s = new StringReader(@"[0372, 0xFA, 0XFA]");
JsonTextReader jsonReader = new JsonTextReader(s);
Assert.IsTrue(jsonReader.Read());
Assert.AreEqual(JsonToken.StartArray, jsonReader.TokenType);
jsonReader.Read();
Assert.AreEqual(JsonToken.Integer, jsonReader.TokenType);
Assert.AreEqual(typeof(long), jsonReader.ValueType);
Assert.AreEqual(250, jsonReader.Value);
jsonReader.Read();
Assert.AreEqual(JsonToken.Integer, jsonReader.TokenType);
Assert.AreEqual(typeof(long), jsonReader.ValueType);
Assert.AreEqual(250, jsonReader.Value);
jsonReader.Read();
Assert.AreEqual(JsonToken.Integer, jsonReader.TokenType);
Assert.AreEqual(typeof(long), jsonReader.ValueType);
Assert.AreEqual(250, jsonReader.Value);
Assert.IsTrue(jsonReader.Read());
Assert.AreEqual(JsonToken.EndArray, jsonReader.TokenType);
Assert.IsFalse(jsonReader.Read());
}
[Test]
public void ReadOctalNumberAsInt32()
{