public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> filterDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(filterDict.First().Value.ToString());

            TruncateTokenFilter filter = new TruncateTokenFilter(filterDict.First().Key);
            TokenFilterBase.Deserialize(filter, fieldDict);
            filter.Length = fieldDict.GetInt32(_LENGTH, TruncateTokenFilter._LENGTH_DEFAULT);

            return filter;
        }
        public void PASS_Create()
        {
            TruncateTokenFilter filter = new TruncateTokenFilter("name")
            {
                Version = 2.4,
                Length = 9
            };

            Assert.IsNotNull(filter);
            Assert.AreEqual("name", filter.Name);
            Assert.AreEqual(2.4, filter.Version);
            Assert.AreEqual((int)9, filter.Length);
        }
        public void PASS_Serialize()
        {
            TruncateTokenFilter filter = new TruncateTokenFilter("name")
            {
                Version = 2.4,
                Length = 9
            };

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

            string expectedJson = "{\"name\":{\"type\":\"truncate\",\"version\":2.4,\"length\":9}}";
            Assert.AreEqual(expectedJson, json);
        }