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("*****@*****.**")); }
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 – B")); Assert.Equal("\"&<>", TP.Process(""&«»")); }