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

            PatternReplaceTokenFilter filter = new PatternReplaceTokenFilter(filterDict.First().Key, fieldDict.GetString(_PATTERN), fieldDict.GetString(_REPLACEMENT));
            TokenFilterBase.Deserialize(filter, fieldDict);

            return filter;
        }
        public void PASS_Serialize()
        {
            PatternReplaceTokenFilter filter = new PatternReplaceTokenFilter("name", "pattern", "replace")
            {
                Version = 2.4
            };

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

            string expectedJson = "{\"name\":{\"type\":\"pattern_replace\",\"version\":2.4,\"pattern\":\"pattern\",\"replacement\":\"replace\"}}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Create()
        {
            PatternReplaceTokenFilter filter = new PatternReplaceTokenFilter("name", "pattern", "replace")
            {
                Version = 2.4
            };

            Assert.IsNotNull(filter);
            Assert.AreEqual("name", filter.Name);
            Assert.AreEqual(2.4, filter.Version);
            Assert.AreEqual("pattern", filter.Pattern);
            Assert.AreEqual("replace", filter.Replacement);
        }