public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> propDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            GeoPointProperty prop = new GeoPointProperty(propDict.First().Key);

            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(propDict.First().Value.ToString());
            DocumentPropertyBase.Deserialize(prop, fieldDict);
            prop.IndexLatLon = fieldDict.GetBool(_INDEX_LAT_LON, GeoPointProperty._INDEX_LAT_LON_DEFAULT);
            prop.IndexGeoHash = fieldDict.GetBool(_INDEX_GEO_HASH, GeoPointProperty._INDEX_GEO_HASH_DEFAULT);
            prop.IndexGeoHashPrefix = fieldDict.GetBool(_INDEX_GEO_HASH_PREFIX, GeoPointProperty._INDEX_GEO_HASH_PREFIX_DEFAULT);
            prop.GeoHashPrecision = fieldDict.GetInt32(_GEO_HASH_PRECISION, GeoPointProperty._GEO_HASH_PRECISION_DEFAULT);
            prop.Validate = fieldDict.GetBool(_VALIDATE, GeoPointProperty._VALIDATE_DEFAULT);
            prop.ValidateLatitude = fieldDict.GetBool(_VALIDATE_LAT, GeoPointProperty._VALIDATE_LAT_DEFAULT);
            prop.ValidateLongitude = fieldDict.GetBool(_VALIDATE_LON, GeoPointProperty._VALIDATE_LON_DEFAULT);
            prop.Normalize = fieldDict.GetBool(_NORMALIZE, GeoPointProperty._NORMALIZE_DEFAULT);
            prop.NormalizeLatitude = fieldDict.GetBool(_NORMALIZE_LAT, GeoPointProperty._NORMALIZE_LAT_DEFAULT);
            prop.NormalizeLongitude = fieldDict.GetBool(_NORMALIZE_LON, GeoPointProperty._NORMALIZE_LON_DEFAULT);

            if (fieldDict.ContainsKey(_FIELD_DATA))
            {
                Dictionary<string, object> fieldDataDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(fieldDict.GetString(_FIELD_DATA));

                if (fieldDataDict.ContainsKey(_PRECISION))
                    prop.CompressionPrecision = new Distance.DistanceValue(fieldDataDict.GetString(_PRECISION));
            }

            return prop;
        }
        public void PASS_Serialize()
        {
            GeoPointProperty prop = new GeoPointProperty("geo-point-name")
            {
                IndexLatLon = true,
                IndexGeoHashPrefix = true,
                CompressionPrecision = new Distance.DistanceValue(1, DistanceUnitEnum.Millimeter)
            };
            string json = JsonConvert.SerializeObject(prop);
            Assert.IsNotNull(json);

            string expectedJson = "{\"geo-point-name\":{\"type\":\"geo_point\",\"lat_lon\":true,\"geohash_prefix\":true,\"fielddata\":{\"format\":\"compressed\",\"precision\":\"1mm\"}}}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Create()
        {
            GeoPointProperty prop = new GeoPointProperty("geo-point-name")
            {
                IndexLatLon = true,
                IndexGeoHashPrefix = true,
                CompressionPrecision = new Distance.DistanceValue(1, DistanceUnitEnum.Millimeter)
            };

            Assert.IsNotNull(prop);
            Assert.AreEqual("geo-point-name", prop.Name);
            Assert.AreEqual(true, prop.IndexLatLon);
            Assert.AreEqual(true, prop.IndexGeoHashPrefix);
            Assert.AreEqual("1mm", prop.CompressionPrecision.ToString());
        }