public void PASS_Serialize()
        {
            DocumentTimestamp stamp = new DocumentTimestamp()
            {
                Format = new DateFormat(DateTimeFormatEnum.DateTime),
                Path = "timestamp"
            };

            string json = JsonConvert.SerializeObject(stamp);
            Assert.IsNotNull(json);

            string expectedJson = "{\"enabled\":true,\"path\":\"timestamp\",\"format\":\"date_time\"}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Create()
        {
            DocumentTimestamp stamp = new DocumentTimestamp()
            {
                Format = new DateFormat(DateTimeFormatEnum.DateTime),
                Path = "timestamp"
            };

            Assert.IsNotNull(stamp);
            Assert.AreEqual(true, stamp.IsEnabled);
            Assert.AreEqual(IndexSettingEnum.NotAnalyzed, stamp.Index);
            Assert.AreEqual(false, stamp.Store);
            Assert.AreEqual("timestamp", stamp.Path);
            Assert.AreEqual("date_time", stamp.Format.Format);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> fieldDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            DocumentTimestamp timestamp = new DocumentTimestamp();

            timestamp.IsEnabled = fieldDict.GetBool(_IS_ENABLED, DocumentTimestamp._IS_ENABLED_DEFAULT);
            MappingBase.Deserialize(timestamp, fieldDict);
            timestamp.Path = fieldDict.GetStringOrDefault(_PATH);
            if (fieldDict.ContainsKey(_FORMAT))
            {
                timestamp.Format = new DateFormat(fieldDict.GetString(_FORMAT));
            }

            return timestamp;
        }