public void PASS_Create()
        {
            DateProperty prop = new DateProperty("dateme");

            Assert.IsNotNull(prop);
            Assert.AreEqual("dateme", prop.Name);
        }
        public void PASS_Serialize()
        {
            DateProperty prop = new DateProperty("dateme");
            string json = JsonConvert.SerializeObject(prop);
            Assert.IsNotNull(json);

            string expectedJson = "{\"dateme\":{\"type\":\"date\"}}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Serialize_Format()
        {
            DateProperty prop = new DateProperty("dateme")
                {
                    Format = new DateFormat(DateTimeFormatEnum.DateHourMinute)
                };
            string json = JsonConvert.SerializeObject(prop);
            Assert.IsNotNull(json);

            string expectedJson = "{\"dateme\":{\"type\":\"date\",\"format\":\"date_hour_minute\"}}";
            Assert.AreEqual(expectedJson, json);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> propDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            DateProperty prop = new DateProperty(propDict.First().Key);

            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(propDict.First().Value.ToString());
            FieldProperty.Deserialize(prop, fieldDict);
            prop.PrecisionStep = fieldDict.GetInt32(_PRECISION_STEP, DateProperty._PRECISION_STEP_DEFAULT);
            if (fieldDict.ContainsKey(_FORMAT))
                prop.Format = new DateFormat(fieldDict.GetString(_FORMAT));
            prop.IgnoreMalformed = fieldDict.GetBool(_IGNORE_MALFORMED, DateProperty._IGNORE_MALFORMED_DEFAULT);
            prop.DocValues = fieldDict.GetBool(_DOC_VALUES, DateProperty._DOCS_VALUE_DEFAULT);

            return prop;
        }