public void PASS_Create()
        {
            GeoShapeProperty prop = new GeoShapeProperty("geo-shape-name")
            {
                Tree = PrefixTreeEnum.QuadTree,
                Precision = new DistanceValue(10, DistanceUnitEnum.Meter),
                DistanceErrorPercentage = 0.25
            };

            Assert.IsNotNull(prop);
            Assert.AreEqual("geo-shape-name", prop.Name);
            Assert.AreEqual(PrefixTreeEnum.QuadTree, prop.Tree);
            Assert.AreEqual("10m", prop.Precision.ToString());
            Assert.AreEqual(0.25, prop.DistanceErrorPercentage);
        }
        public void PASS_Serialize()
        {
            GeoShapeProperty prop = new GeoShapeProperty("geo-shape-name")
            {
                Tree = PrefixTreeEnum.QuadTree,
                Precision = new DistanceValue(10, DistanceUnitEnum.Meter),
                DistanceErrorPercentage = 0.25
            };

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

            string expectedJson = "{\"geo-shape-name\":{\"type\":\"geo_shape\",\"tree\":\"quadtree\",\"precision\":\"10m\",\"distance_error_pct\":0.25}}";
            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);
            GeoShapeProperty prop = new GeoShapeProperty(propDict.First().Key);

            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(propDict.First().Value.ToString());
            DocumentPropertyBase.Deserialize(prop, fieldDict);
            prop.DistanceErrorPercentage = fieldDict.GetDouble(_DISTANCE_ERROR_PERCENTAGE, GeoShapeProperty._DISTANCE_ERROR_PERCENTAGE_DEFAULT);
            if (fieldDict.ContainsKey(_PRECISION))
                prop.Precision = new DistanceValue(fieldDict.GetString(_PRECISION));
            prop.Tree = PrefixTreeEnum.Find(fieldDict.GetString(_TREE, GeoShapeProperty._TREE_DEFAULT.ToString()));
            prop.TreeLevels = fieldDict.GetInt64OrNull(_TREE_LEVELS);

            return prop;
        }