Ejemplo n.º 1
0
        public void RemoveHtmlFromEmptyString()
        {
            var content      = string.Empty;
            var cleanContent = HtmlTagsRemover.Remove(content);

            cleanContent.Should().Be(string.Empty);
        }
Ejemplo n.º 2
0
        public void RemoveHtmlWithAttributesFromString()
        {
            var content      = "<p> Veja a <a href = \"https://www.minutoseguros.com.br/blog/imprensa/dicas-empreendedorismo-marcelo-blay-1\" target = \"_blank\" > parte 1 </ a >";
            var cleanContent = HtmlTagsRemover.Remove(content);

            cleanContent.Should().Be("Veja a  parte 1");
        }
Ejemplo n.º 3
0
        public void WhenInputContainsNestedTagsAndInnerTagDontHaveClosingTag_ShouldRemove()
        {
            string input    = "<b>joy<a>george</b>";
            string expected = "joygeorge";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 4
0
        public void WhenTextContainsNoClosingTag_ShouldRemove()
        {
            string input    = "<b>joy";
            string expected = "joy";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 5
0
        public void WhenTextContainsSelfClosingTagWithAttribute_ShouldReturnEmptyString()
        {
            string input    = "<b name='joy'></b>";
            string expected = "";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 6
0
        public void WhenTextContainsBothOpeningAndEndingTagWithAttribute_ShouldRemoveBoth()
        {
            string input    = "<b name='dfd'>joy</b>";
            string expected = "joy";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 7
0
        public void WhenInputContainsOpeningTagIsNotClosed_ShouldNotRemove()
        {
            string input    = "<b joy";
            string expected = "<b joy";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 8
0
        public void WhenInputContainsNestedTagsAndInnerTagIsNotClosed_ShouldRemoveInnerTagAndReturnAllContentsInOuterTag()
        {
            string input    = "<b>joy<a george</a> mon</b>";
            string expected = "joy mon";
            string actual   = HtmlTagsRemover.Remove(input);

            Assert.IsTrue(string.Equals(expected, actual), "NOt able to remove opening and closing tags");
        }
Ejemplo n.º 9
0
        public void RemoveHtmlFromString()
        {
            var content = "<html><body><p>Teste</p><br/></body></html>";

            var cleanContent = HtmlTagsRemover.Remove(content);

            cleanContent.Should().Be("Teste");
        }
Ejemplo n.º 10
0
        private string GetItemContent(SyndicationElementExtensionCollection extensions)
        {
            var content = string.Empty;

            foreach (SyndicationElementExtension extension in extensions)
            {
                if (extension.GetObject <XElement>().Name.LocalName == "encoded")
                {
                    content = extension.GetObject <XElement>().Value;
                }
            }
            return(HtmlTagsRemover.Remove(content));
        }