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

            //Assert
            result.Should().Be(expectedOutput);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public void PropertyTestsShouldNotThrowException(string inputA, string inputB)
 {
     //Act
     Textorize.HtmlToPlainText(inputA + inputB);
 }