Example #1
0
        public void SkipAttributesTests(string htmlInput, string expectedOutput)
        {
            //Act
            string result = Textorize.HtmlToPlainText(htmlInput);

            //Assert
            result.Should().Be(expectedOutput);
        }
Example #2
0
        //[TestCase(" \nhello hoi \n ")]
        public void TextorizeTwiceOverPlainTextShouldHaveEqualResults(string input)
        {
            var first  = Textorize.HtmlToPlainText(input);
            var second = Textorize.HtmlToPlainText(first);

            first.Should().BeEquivalentTo(second);

            Textorize.HtmlToPlainText(WebUtility.HtmlEncode(second)).Should().BeEquivalentTo(first);
        }
Example #3
0
        public void HtmlFileShouldGiveSomeReasonableResult()
        {
            //Arrange
            var testFilename = Path.Join(TestContext.CurrentContext.TestDirectory, "testdata", "input_html_01.html");

            //Act
            var result = Textorize.HtmlToPlainText(File.ReadAllText(testFilename));

            File.WriteAllText(Path.Join(TestContext.CurrentContext.TestDirectory, "input_html_01-sanitized.txt"),
                              result);

            //Assert
            Console.Write(result);
        }
Example #4
0
        public void HtmlFileTwiceShouldBeEquivalent()
        {
            //Arrange
            var testFilename = Path.Join(TestContext.CurrentContext.TestDirectory, "testdata", "input_html_01.html");

            //Act
            var first  = Textorize.HtmlToPlainText(File.ReadAllText(testFilename));
            var second = Textorize.HtmlToPlainText(WebUtility.HtmlEncode(first));

            File.WriteAllText(Path.Join(TestContext.CurrentContext.TestDirectory, "input_html_01-2-sanitized.txt"),
                              second);

            //Assert Textorize(input) == Textorize(HtmlEncode(Textorize(input)))
            first.Should().BeEquivalentTo(second);
        }
Example #5
0
 public void PropertyTestsShouldNotThrowException(string inputA, string inputB)
 {
     //Act
     Textorize.HtmlToPlainText(inputA + inputB);
 }