public void ImageHeightFloat_OK() { var source = "[IMG:http://wab.com/src.png| HEIGHT: 100px|FLOAT:right]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><img src=\"http://wab.com/src.png\" alt=\"http://wab.com/src.png\" style=\"height: 100px;float: right;\" /></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void SimpleText_OneLine_OK() { var source = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, </p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void UrlHttpAndText_OK() { var source = "[URL:http://wab.com/s_rc.png|TEXT:this is the path to source]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><a href=\"http://wab.com/s_rc.png\" title=\"http://wab.com/s_rc.png\" >this is the path to source</a></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void ImageWidth_OK() { var source = "[IMG:http://wab.com/src.png | WIDTH:100px ]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><img src=\"http://wab.com/src.png\" alt=\"http://wab.com/src.png\" style=\"width: 100px;\" /></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void StyleBoldItalic_OK() { var source = "[B:bold * txt] ne [I: text _italic]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><b>bold * txt</b> ne <i> text _italic</i></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void StyleStrikeURL_OK() { var source = "do not [S:[URL: click here|#home]]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>do not <del><a href=\"#home\" title=\"#home\" > click here</a></del></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void Unicode_OneLine_OK() { var source = "Nejelo se na Jitřenku, jelo se na tábor. Na opravdický tábor. "; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>Nejelo se na Jitřenku, jelo se na tábor. Na opravdický tábor. </p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void NOTTable_OK() { var source = "notTable | header1 | header2 \r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>notTable | header1 | header2 </p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void TagElement2Lines_OK() { var source = "<a href=\"#myname\"\r\n type=\"myType\">\r\n abc</a>"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><span class=\"tag\" ><a href="#myname"" + "\r\n<br /> type="myType"></span></p>\r\n" + "<p> abc<span class=\"tag\" ></a></span></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void UrlAddressIsRecognized_OK() { var source = "[URL:https://abc.wab.com:555/way/id/this-is-it|TEXT:this is the path to source]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><a href=\"https://abc.wab.com:555/way/id/this-is-it\"" + " title=\"https://abc.wab.com:555/way/id/this-is-it\"" + " >this is the path to source</a></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void ShortTextFirstThenLongUrl_OK() { var source = "[URL:this is the path|https://abc.wab.com:555/way/id/this_is*the-path-too-long/src.png?a=1&d=2]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><a href=\"https://abc.wab.com:555/way/id/this_is*the-path-too-long/src.png?a=1&d=2\"" + " title=\"https://abc.wab.com:555/way/id/this_is*the-path-too-long/src.png?a=1&d=2\"" + " >this is the path</a></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void TableWithBoldText_OK() { var source = "|| heading1 || heading2 \r\n" + "| ara barva | noci je *boldie* \r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<table>\r\n" + "<thead><tr><td>heading1 </td><td>heading2 </td></tr></thead>\r\n" + "<tbody>\r\n<tr><td>ara barva </td><td>noci je <b>boldie</b> </td></tr>\r\n</tbody></table>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void CiteAndBlockQuote_OK() { var source = "|CITE a class is null bardar and void \r\n" + "|BQ string bardarreadonly Where id name\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<cite class=\"cite\" >\r\na class is null bardar and void </cite>\r\n" + "<blockquote class=\"bq\" >\r\nstring bardarreadonly Where id name</blockquote>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void CsharpKeyWordsAsText_OK() { var source = "a class is null and void \r\n" + "string readonly Where id name\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>a class is null and void </p>\r\n" + "<p>string readonly Where id name</p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void Unicode_MoreLines_OK() { var source = "Nejelo se na Jitřenku, jelo se na tábor. Na opravdický tábor. \r\n" + " Zvláštní družina, sestavená ze starších členů oddílu \r\n" + "- byli to Vlasatka, Kulich, Kutilka a Modrásek - "; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>Nejelo se na Jitřenku, jelo se na tábor. Na opravdický tábor. </p>\r\n" + "<p> Zvláštní družina, sestavená ze starších členů oddílu </p>\r\n" + "<p>- byli to Vlasatka, Kulich, Kutilka a Modrásek - </p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void StyleVarAndSampInTable_OK() { var source = "| bar [SAMP:header *h1] | [VAR:de _header] h2 \r\n" + "| ara barva | noci je [SUB:boldie] \r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<table>\r\n<tbody>\r\n" + "<tr><td>bar <samp>header *h1</samp> </td>" + "<td><var>de _header</var> h2 </td></tr>\r\n" + "<tr><td>ara barva </td><td>noci je <sub>boldie</sub> </td></tr>\r\n</tbody></table>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void StyleUnderLineAndSupInList_OK() { var source = "# first [U:item]\r\n" + "# [SUP:second] item\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<ol>\r\n<li>first <ins>item</ins></li>\r\n" + "<li><sup>second</sup> item</li>\r\n" + "</ol>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void SimpleText_MoreLines_OK() { var source = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, \r\n" + " sed do eiusmod tempor incididunt ut labore et \r\n" + "dolore magna aliqua. Ut enim ad minim veniam, "; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, </p>\r\n" + "<p> sed do eiusmod tempor incididunt ut labore et </p>\r\n" + "<p>dolore magna aliqua. Ut enim ad minim veniam, </p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void TagInHTML_OK() { var source = "[HTML <a href=\"#myname\">abc</a> \r\nHTML]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<code class=\"html\" >\r\n" + " <span class=\"tag\" ><span class=\"smbl\" ><</span>a " + "<span class=\"html\" >href</span><span class=\"smbl\" >=</span>" + "<span class=\"qtd\" >"#myname"</span><span class=\"smbl\" >></span></span>" + "abc<span class=\"tag\" ><span class=\"smbl\" ></</span>a<span class=\"smbl\" >></span></span> <br />\r\n" + "</code>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void CsharpKeyWordsAsCode_OK() { var source = "[CODE class is null CODE]\r\n" + "[HTML title id name HTML]\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<code class=\"code\" >\r\n" + " <span class=\"base\" >class</span> <span class=\"spcl\" >is</span> <span class=\"spcl\" >null</span> <br />\r\n</code>\r\n" + "<code class=\"html\" >\r\n" + " <span class=\"html\" >title</span> <span class=\"html\" >id</span> <span class=\"html\" >name</span> <br />\r\n</code>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void CsharpKeyWordsHTML_OK() { var source = "[HTML href style type HTML]\r\n" + "[CODE foreach break Guid CODE]\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<code class=\"html\" >\r\n" + " <span class=\"html\" >href</span> <span class=\"html\" >style</span> <span class=\"html\" >type</span> <br />\r\n</code>\r\n" + "<code class=\"code\" >\r\n" + " <span class=\"flw\" >foreach</span> <span class=\"flw\" >break</span> <span class=\"type\" >Guid</span> <br />\r\n</code>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void UrlQuotedDangerous_OK() { var source = "[URL:\"javascript:alert(1);a\"|TEXT:javascript]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><a href=\"/javascript:alert(1);a\"" + " title=\"/javascript:alert(1);a\"" + " >javascript</a></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void UrlLongHttpAndText2_FAIL() { // too many tokens (more then 12) to see the ending |TEXT: var source = "[URL:https://abc.wab.com:555/way/:a:a:a:a:a:a:a:a:aid/this_is_the_path_too_long/src.png?a=1&d=2 |TEXT:this is the path to source]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><a href=\"https://abc.wab.com:555/way/:a:a:a:a:a:a:a:a:aid/this_is_the_path_too_long/src.png?a=1&d=2\"" + " title=\"https://abc.wab.com:555/way/:a:a:a:a:a:a:a:a:aid/this_is_the_path_too_long/src.png?a=1&d=2\"" + " >this is the path to source</a></p>\r\n"; Assert.IsFalse(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); Assert.IsTrue(result.IsEmpty()); }
public void ImageWithoutAttributes_OK() { var source = "[IMG:src.png]"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p><img src=\"/src.png\" alt=\"/src.png\" style=\"\" /></p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void Paragraph1AndParagraph3_OK() { var source = "|P1 a class is null and void \r\n" + "|P3 string readonly Where id name\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<p class=\"p1\" >\r\na class is null and void </p>\r\n" + "<p class=\"p3\" >\r\nstring readonly Where id name</p>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void TableWithEOF_OK() { var source = "|| heading1 || heading2 \r\n" + "| ara [RED:barva] | |H1 not a heading"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<table>\r\n" + "<thead><tr><td>heading1 </td><td>heading2 </td></tr></thead>\r\n" + "<tbody>\r\n<tr><td>ara <span style=\"color:Red;\" >barva</span> </td>" + "<td>|H1 not a heading</td></tr>\r\n</tbody></table>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void Table_OK() { var source = "| bar header h1 | de header h2 \r\n" + "| ara barva | noci je [B:boldie] \r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<table>\r\n<tbody>\r\n" + "<tr><td>bar header h1 </td><td>de header h2 </td></tr>\r\n" + "<tr><td>ara barva </td><td>noci je <b>boldie</b> </td></tr>\r\n" + "</tbody></table>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void TableWithUrl_OK() { var source = "|| heading1 || heading2 \r\n" + "| ara [NAME:barva] | noci je [URL:http://catarsa.com] \r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<table>\r\n" + "<thead><tr><td>heading1 </td><td>heading2 </td></tr></thead>\r\n" + "<tbody>\r\n<tr><td>ara <a name=\"barva\" ></a> </td>" + "<td>noci je <a href=\"http://catarsa.com\" title=\"http://catarsa.com\" >http://catarsa.com</a> </td></tr>\r\n" + "</tbody></table>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal), "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }
public void Heading1AndHeading3_OK() { var source = "|H1 a class is [|]H2 null and void \r\n" + "|H3 string readonly [|]H4 Where id name\r\n"; var result = new WikiConverter().ConvertToHtml(source); var expected = "<h1>\r\na class is |H2 null and void </h1>\r\n" + "<h3>\r\nstring readonly |H4 Where id name</h3>\r\n"; Assert.IsTrue(result.Equals(expected, StringComparison.Ordinal) , "RESULT:\r\n" + result + "\r\n EXPECTED:\r\n" + expected); }