Beispiel #1
0
        public void TextProcessor_ShouldExludeBurindWords(string text)
        {
            var result        = new ParagraphTextProcessor().GetLiterals(text);
            var wordsExcluder = new WordsExcluder();

            result.Should().NotContain(p => wordsExcluder.MustBeExclude(p));
        }
        public void ExcludeForbiddenWords()
        {
            var excluder             = A.Fake <IWordExcluder>();
            var excludedWordsHashSet = new HashSet <string> {
                "a", "b", "c", "d"
            };

            A.CallTo(() => excluder.GetExcludedWords()).Returns(excludedWordsHashSet.AsResult());

            var preprocessor      = new WordsExcluder(excluder);
            var wordsToPreprocess = new List <string> {
                "a", "b", "e", "f"
            };

            var result = preprocessor
                         .PreprocessWords(wordsToPreprocess)
                         .GetValueOrThrow();
            var expectedResult = new List <string> {
                "e", "f"
            };

            result.ShouldBeEquivalentTo(expectedResult);
        }