Пример #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));
        }
Пример #2
0
        public void TextProcessor_ShouldWordsToLowerCase(string text)
        {
            var result = new ParagraphTextProcessor().GetLiterals(text);

            foreach (var word in result)
            {
                Assert.AreEqual(word.ToLower(), word);
            }
        }
Пример #3
0
        public void ReadConvertExcludeAndGetCountMetric()
        {
            var path = $".{Path.DirectorySeparatorChar}fileTest.txt";
            var text = "I\nam\nBetman\nI\nSpeed\nI\nPower\n\nPower\nRanger\nRed\nPower\nRanger";

            File.WriteAllText(path, text);
            var textReader    = new TextReaderTxt();
            var textProcessor = new ParagraphTextProcessor();
            var wordsMetric   = new CountWordMetric();
            var result        = wordsMetric.GetMetric(textProcessor.GetLiterals(textReader.ReadText(path)));

            File.Delete(path);
            var expected = new Dictionary <string, double>();

            expected["am"]     = 1;
            expected["betman"] = 1;
            expected["speed"]  = 1;
            expected["power"]  = 3;
            expected["ranger"] = 2;
            expected["red"]    = 1;
            Assert.AreEqual(expected, result);
        }
Пример #4
0
        public void TextProcessor_ShouldExludeEmptyString(string text)
        {
            var result = new ParagraphTextProcessor().GetLiterals(text);

            result.Should().NotContain(string.Empty);
        }