Beispiel #1
0
        public void Test_ManualParser_OnSomeInputString()
        {
            var parser = new ManualParser();

            parser.ParseBlock($"<a>Hello world</a>");
            var texts = parser.ResultTexts.ToList();

            Assert.AreEqual(1, texts.Count);
            Assert.AreEqual("Hello world", texts[0]);
        }
Beispiel #2
0
        public void Test_ManualParser_OnFullReadFile_And_Count_ResultTexts()
        {
            var fileName = Path.Combine(TestContext.CurrentContext.GetTestProjectPath(),
                                        @"SampleFiles\Создаем программное обеспечение для бизнеса - SimbirSoft.html");

            var fileContent = File.ReadAllText(fileName);

            var configuration = ParseConfiguration.Default();
            var parser        = new ManualParser(configuration.ExcludeTags);

            parser.ParseBlock(fileContent);

            Assert.AreEqual(250, parser.ResultTexts.Count());
        }
Beispiel #3
0
        public void Test_ManualParser_OnWrongInputString()
        {
            var parser = new ManualParser();

            Assert.Throws <ParseException>(() => { parser.ParseBlock($"<a>Hello world</span>"); });
        }