public void MultipleWordsAreCachedAndOnlySomeWordsIsInListShouldNotMatch2() { var words = new List <string> { "foo", "doo", "coo" }; var stopwordManager = new StopwordManager(words); stopwordManager.CacheIfStopword("foo").ShouldBe(true); stopwordManager.CacheIfStopword("doo fout").ShouldBe(true); stopwordManager.ShouldCheck().ShouldBe(true); stopwordManager.MatchAllStopwords("one bar foo two doo three").ShouldBe(false); }
public void WordIsCachedAndWordIsInListAtMiddleShouldMatch() { var words = new List <string> { "foo" }; var stopwordManager = new StopwordManager(words); stopwordManager.CacheIfStopword("foo").ShouldBe(true); stopwordManager.ShouldCheck().ShouldBe(true); stopwordManager.MatchAllStopwords("one bar foo two three").ShouldBe(true); }
public void WordIsCachedAndWordIsInListAtStartShouldMatch() { var words = new List <string> { "foo" }; var stopwordManager = new StopwordManager(words); stopwordManager.CacheIfStopword("foo").ShouldBe(true); stopwordManager.ShouldCheck().ShouldBe(true); stopwordManager.MatchAllStopwords("foo bar one two").ShouldBe(true); }
public void WordIsCachedButWordNotInListShouldNotMatch() { var words = new List <string> { "foo" }; var stopwordManager = new StopwordManager(words); stopwordManager.CacheIfStopword("foo").ShouldBe(true); stopwordManager.ShouldCheck().ShouldBe(true); stopwordManager.MatchAllStopwords("foolish").ShouldBe(false); }
public void WordNotInListIsNotCachedWithShouldCheckBeFalse() { var words = new List <string> { "foo", "doo", "coo" }; var stopwordManager = new StopwordManager(words); stopwordManager.CacheIfStopword("bar").ShouldBe(false); stopwordManager.ShouldCheck().ShouldBe(false); // Don't be confused. This is returning true NOT because all stop words are matching, // but because we need to tell the caller the this case is not applicable since cache list is empty. stopwordManager.MatchAllStopwords("one bar foo two doo three").ShouldBe(true); }