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());

            UniqueTokenFilter filter = new UniqueTokenFilter(filterDict.First().Key);
            TokenFilterBase.Deserialize(filter, fieldDict);
            filter.OnlyOnSamePosition = fieldDict.GetBool(_ONLY_ON_SAME_POSITION, UniqueTokenFilter._ONLY_ON_SAME_POSITION_DEFAULT);

            return filter;
        }
        public void PASS_Create()
        {
            UniqueTokenFilter filter = new UniqueTokenFilter("name")
            {
                Version = 2.4,
                OnlyOnSamePosition = true
            };

            Assert.IsNotNull(filter);
            Assert.AreEqual("name", filter.Name);
            Assert.AreEqual(2.4, filter.Version);
            Assert.AreEqual(true, filter.OnlyOnSamePosition);
        }
        public void PASS_Serialize()
        {
            UniqueTokenFilter filter = new UniqueTokenFilter("name")
            {
                Version = 2.4,
                OnlyOnSamePosition = true
            };

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

            string expectedJson = "{\"name\":{\"type\":\"unique\",\"version\":2.4,\"only_on_same_position\":true}}";
            Assert.AreEqual(expectedJson, json);
        }