public void PASS_Create() { DocumentSize size = new DocumentSize() { Store = true }; Assert.IsNotNull(size); Assert.AreEqual(true, size.IsEnabled); Assert.AreEqual(true, size.Store); }
public void PASS_Serialize() { DocumentSize size = new DocumentSize() { Store = true }; string json = JsonConvert.SerializeObject(size); Assert.IsNotNull(json); string expectedJson = "{\"enabled\":true,\"store\":true}"; Assert.AreEqual(expectedJson, json); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { Dictionary<string, object> fieldDict = serializer.Deserialize<Dictionary<string, object>>(reader); DocumentSize size = new DocumentSize() { IsEnabled = fieldDict.GetBool(_IS_ENABLED, DocumentSize._IS_ENABLED_DEFAULT), Store = fieldDict.GetBool(_STORE, DocumentSize._STORE_DEFAULT) }; return size; }