Ejemplo n.º 1
0
        public void GUpdateWordsCountListTest()
        {
            string teststring = "this is a test string to Test  String parsing test.";

            _wordsCountDictionary = _sentenceParserHelper.GetWordsCountDictionary(teststring);
            ObservableCollection <IWordCountInfo> bindedlist = new ObservableCollection <IWordCountInfo>();

            _sentenceParserHelper.UpdateWordsCountList(ref bindedlist, _wordsCountDictionary);
            Assert.AreEqual(7, bindedlist.Count);
            Assert.AreEqual(3, bindedlist[0].Count);
            Assert.AreEqual("test", bindedlist[0].Word);

            teststring            = "this is a test string to Test  String test.";
            _wordsCountDictionary = _sentenceParserHelper.GetWordsCountDictionary(teststring);
            _sentenceParserHelper.UpdateWordsCountList(ref bindedlist, _wordsCountDictionary);
            Assert.AreEqual(6, bindedlist.Count);
            Assert.AreEqual(3, bindedlist[0].Count);
            Assert.AreEqual("test", bindedlist[0].Word);

            teststring            = "this is a test string to Test  String test string string who.";
            _wordsCountDictionary = _sentenceParserHelper.GetWordsCountDictionary(teststring);
            _sentenceParserHelper.UpdateWordsCountList(ref bindedlist, _wordsCountDictionary);
            Assert.AreEqual(7, bindedlist.Count);
            Assert.AreEqual(4, bindedlist[0].Count);
            Assert.AreEqual("string", bindedlist[0].Word);
        }
Ejemplo n.º 2
0
 private void RefreshResult()
 {
     _sentenceParserHelper.UpdateWordsCountList(ref _wordsCountBindedList, _sentenceParserHelper.GetWordsCountDictionary(_sentence));
     OnPropertyChanged("WordsCountList");
 }