public void PASS_Serialize_No_Stopwords()
        {
            StopAnalyzer analyzer = new StopAnalyzer("name")
            {
                Version = 4.6,
                StopwordsPath = "path",
                Stopwords = new List<string>(),
                Aliases = new List<string>() { "alias1", "alias2" }
            };

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

            string expectedJson = "{\"name\":{\"type\":\"stop\",\"version\":4.6,\"aliases\":[\"alias1\",\"alias2\"],\"stopwords\":\"_none_\",\"stopwords_path\":\"path\"}}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Create()
        {
            StopAnalyzer analyzer = new StopAnalyzer("name")
            {
                Version = 4.6,
                Stopwords = new List<string>() { "stop1", "stop2" },
                Aliases = new List<string>() { "alias1", "alias2" },
                StopwordsPath = "path"
            };

            Assert.IsNotNull(analyzer);
            Assert.AreEqual("name", analyzer.Name);
            Assert.AreEqual(4.6, analyzer.Version);
            Assert.AreEqual("path", analyzer.StopwordsPath);
            Assert.AreEqual("stop1", analyzer.Stopwords.First());
            Assert.AreEqual("stop2", analyzer.Stopwords.Last());
            Assert.AreEqual("alias1", analyzer.Aliases.First());
            Assert.AreEqual("alias2", analyzer.Aliases.Last());
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> analyzerDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(analyzerDict.First().Value.ToString());

            StopAnalyzer analyzer = new StopAnalyzer(analyzerDict.First().Key);
            AnalyzerBase.Deserialize(analyzer, fieldDict);
            if (fieldDict.ContainsKey(_STOPWORDS))
            {
                string stopwordsStr = fieldDict.GetString(_STOPWORDS);
                if (stopwordsStr.Equals(StopAnalyzer._EMPTY_STOPWORDS_DEFAULT))
                {
                    analyzer.Stopwords = new List<string>();
                }                    
                else
                {
                    analyzer.Stopwords = JsonConvert.DeserializeObject<IEnumerable<string>>(stopwordsStr);
                }
            }

            analyzer.StopwordsPath = fieldDict.GetStringOrDefault(_STOPWORDS_PATH);

            return analyzer;
        }