コード例 #1
0
 public void Createhashtag()
 {
     instance = WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "#word", null, POSTags.Instance.NN);
     Assert.AreEqual(NamedEntities.Hashtag, instance.Entity);
     instance.Entity = NamedEntities.Date;
     Assert.AreEqual(NamedEntities.Hashtag, instance.Entity);
 }
コード例 #2
0
 public void Setup()
 {
     helper = new WordsHandlerHelper();
     helper.RawTextExractor.Setup(item => item.GetWord("test")).Returns("T");
     helper.Handler.Setup(item => item.CheckSentiment(It.IsAny <WordOccurrence>())).Returns(new SentimentValue(new TestWordItem(), 2));
     helper.Handler.Setup(item => item.IsStop(It.IsAny <WordOccurrence>())).Returns(true);
     helper.Handler.Setup(item => item.MeasureQuantifier(It.IsAny <WordOccurrence>())).Returns(2);
     instance = WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, POSTags.Instance.NN);
 }
コード例 #3
0
 public void CreateArguments()
 {
     Assert.Throws <ArgumentNullException>(() => WordOccurrence.Create(null, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, POSTags.Instance.NN));
     Assert.Throws <ArgumentNullException>(() => WordOccurrence.Create(helper.Handler.Object, null, helper.InquirerManager.Object, "Test", null, POSTags.Instance.NN));
     Assert.Throws <ArgumentNullException>(() => WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, null, "Test", null, POSTags.Instance.NN));
     Assert.Throws <ArgumentException>(() => WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, null, null, POSTags.Instance.NN));
     Assert.Throws <ArgumentNullException>(() => WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, null));
     Assert.Throws <ArgumentException>(() => WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, POSTags.Instance.SBAR));
 }
コード例 #4
0
        public void Add()
        {
            Assert.Throws <ArgumentNullException>(() => instance.Add(null));
            instance.Add(WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, POSTags.Instance.NN));
            instance.Add(WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "Test", null, POSTags.Instance.NN));

            Assert.AreEqual("test test", instance.Text);
            Assert.AreEqual("t t", instance.Stemmed);
            Assert.AreEqual("NN", instance.POS.Tag);
            Assert.IsNotNull(instance.Relationship);
            Assert.IsFalse(instance.IsSentiment);
            Assert.IsFalse(instance.IsTopAttribute);
            Assert.AreEqual(2, instance.QuantValue);
            Assert.IsFalse(instance.IsQuestion);
            Assert.IsFalse(instance.IsFeature);
            Assert.IsFalse(instance.IsFixed);
            Assert.IsFalse(instance.IsStopWord);
            Assert.IsFalse(instance.IsSimple);
            Assert.AreEqual(2, instance.AllWords.Count());
        }
コード例 #5
0
 public void CreateFixed()
 {
     instance = WordOccurrence.Create(helper.Handler.Object, helper.RawTextExractor.Object, helper.InquirerManager.Object, "xxxbad", null, POSTags.Instance.NN);
     Assert.IsTrue(instance.IsFixed);
 }