-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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user