public void checkPhraseFoundWordTest() { string context = "", allContexts = ""; string BodyContent = "This text has baDword and \"2wronGword\" and nonOword3 wroNgworK"; List <string> words = FilterPolicy.getWords(BodyContent); areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "text", Type = BlockPhraseType.CONTAIN // Not supported in checkPhraseFoundWord }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "notfound", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "badword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "wrongword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "nonoword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "rongwor", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; //Console.Write(allContexts); }
public void getWordsTest() { string text = "<input value=\"gogo\"></input>"; Assert.AreEqual(true, FilterPolicy.getWords(text).Contains("gogo")); text = "go home \"gogo\" g"; Assert.AreEqual(true, FilterPolicy.getWords(text).Contains("gogo")); text = "first second thidr122"; var words = FilterPolicy.getWords(text); areTrue(words.Contains("first")); areTrue(words.Contains("second")); areTrue(words.Contains("thidr")); areFalse(words.Contains("thidr122")); }
public void PhraseBug() { string url = "https://www.youtube.com/results?search_query=fetish&pbj=1"; areTrue(FilterPolicy.getWords(url).Contains("fetish")); }