-Updated nuspec file for 4.0

-Added Load and Parse helper methods to JToken
-Fixed performance issues when deserializing with partial type names
-Fixed deserializing certain decimal values on classes with non-default constructors
This commit is contained in:
JamesNK
2011-01-08 04:39:33 +00:00
parent 0fb78fdb91
commit ac6c65f48a
11 changed files with 159 additions and 24 deletions
@@ -4015,5 +4015,33 @@ keyword such as type of business.""
Assert.AreEqual("Success", deserializedResponse.Name);
Assert.IsTrue(deserializedResponse.Data.DeepEquals(response.Data));
}
public abstract class Test<T>
{
public abstract T Value { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class DecimalTest : Test<decimal>
{
protected DecimalTest() { }
public DecimalTest(decimal val)
{
Value = val;
}
[JsonProperty]
public override decimal Value { get; set; }
}
[Test]
public void OnError()
{
var data = new DecimalTest(decimal.MinValue);
var json = JsonConvert.SerializeObject(data);
var obj = JsonConvert.DeserializeObject<DecimalTest>(json);
Assert.AreEqual(decimal.MinValue, obj.Value);
}
}
}