public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { Dictionary<string, object> propDict = serializer.Deserialize<Dictionary<string, object>>(reader); IntegerProperty prop = new IntegerProperty(propDict.First().Key); NumberProperty.DeserializeNumber(prop, JsonConvert.DeserializeObject<Dictionary<string, object>>(propDict.First().Value.ToString())); return prop; }
public void PASS_Create() { IntegerProperty prop = new IntegerProperty("integerme") { PrecisionStep = 5 }; Assert.IsNotNull(prop); Assert.AreEqual("integerme", prop.Name); Assert.AreEqual((int)5, prop.PrecisionStep); }
public void PASS_Serialize() { IntegerProperty prop = new IntegerProperty("integerme") { PrecisionStep = 5 }; string json = JsonConvert.SerializeObject(prop); Assert.IsNotNull(json); string expectedJson = "{\"integerme\":{\"type\":\"integer\",\"precision_step\":5}}"; Assert.AreEqual(expectedJson, json); }