public void ReplaceEmailsWithLinksTest()
        {
            Assert.Equal("<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", TP.Process("*****@*****.**"));
            Assert.Equal("<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", TP.Process("*****@*****.**"));
            Assert.Equal("<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", TP.Process("*****@*****.**"));

            Assert.Equal("<p>foo@bar</p>", TP.Process("foo@bar"));
            Assert.Equal("<p>[email protected]</p>", TP.Process("*****@*****.**"));
        }
예제 #2
0
        public override void Process()
        {
            Results.Clear();

            if (!string.IsNullOrEmpty(Source))
            {
                if (HtmlHelper.IsHtml(Source))
                {
                    Results.Add(new TextResult {
                        Text      = HtmlToHtmlProcessing.Process(Source),
                        Label     = "HTML",
                        TextColor = "darkblue",
                        Format    = TextResultFormat.HTML
                    });

                    Results.Add(new TextResult {
                        Text   = TextToTextProcessing.Process(HtmlToTextProcessing.Process(Source)),
                        Label  = "Text",
                        Format = TextResultFormat.Text
                    });
                }
                else
                {
                    var textResult = new TextResult {
                        Text   = TextToTextProcessing.Process(Source),
                        Label  = "Text",
                        Format = TextResultFormat.Text
                    };

                    Results.Add(textResult);

                    Results.Add(new TextResult {
                        Text      = TextSimplifyProcessing.Process(textResult.Text),
                        Label     = "Simplified text",
                        TextColor = "darkred",
                        Format    = TextResultFormat.Text
                    });

                    Results.Add(new TextResult {
                        Text      = TextToHtmlProcessing.Process(textResult.Text),
                        Label     = "HTML",
                        TextColor = "darkblue",
                        Format    = TextResultFormat.HTML
                    });
                }
            }
        }
 public void NormalizeEndlinesTest()
 {
     Assert.Equal("First line\nSecond line\nThird line",
                  TP.Process("First line\r\nSecond line\rThird line\n"));
 }
 public void ReplaceNamedEntitesWithCharsTest()
 {
     Assert.Equal("A\u00A0\u2013 B", TP.Process("A&nbsp;&ndash; B"));
     Assert.Equal("\"&<>", TP.Process("&quot;&amp;&laquo;&raquo;"));
 }