diff --git a/Core-Tests/FormatterTests.cs b/Core-Tests/FormatterTests.cs index f70091a..7485697 100644 --- a/Core-Tests/FormatterTests.cs +++ b/Core-Tests/FormatterTests.cs @@ -10,22 +10,38 @@ using ScrewTurn.Wiki.PluginFramework; namespace ScrewTurn.Wiki.Tests { [TestFixture] + public class FormatterTests { + private const string Input = +@"'''bold''' ''italic'' __underlined__ --striked-- [page1]\r\n[page2|title] +* item 1 +* item 2 + +second line"; + + private const string ExpectedOutput = +@"bold italic underlined striked page1\r\n" + +"title\n
second line\n"; + + + private MockRepository mocks; [Test] - public void Format() { + [TestCase("@@rigatesto1\r\nriga2@@","
rigatesto1\r\nriga2
\n")] + [TestCase(Input,ExpectedOutput)] + public void Format(string input, string output) { FormattingContext context = FormattingContext.PageContent; PageInfo currentPage = null; string[] linkedPages = null; - string output = Formatter.Format(Input, false, context, currentPage, out linkedPages, false); + string _input = Formatter.Format(input, false, context, currentPage, out linkedPages, false); // Ignore \r characters // Ignore \n characters - Assert.AreEqual(ExpectedOutput, output, "Formatter output is different from expected output"); + Assert.AreEqual(output, _input, "Formatter output is different from expected output"); } [SetUp] @@ -81,17 +97,6 @@ namespace ScrewTurn.Wiki.Tests { mocks.VerifyAll(); } - private const string Input = -@"'''bold''' ''italic'' __underlined__ --striked-- [page1]\r\n[page2|title] -* item 1 -* item 2 - -second line"; - - private const string ExpectedOutput = -@"bold italic underlined striked page1\r\n" + -"title\n
second line\n"; - } public class DummyRequest : System.Web.HttpWorkerRequest { diff --git a/Core/Formatter.cs b/Core/Formatter.cs index 123a1d4..e33ce60 100644 --- a/Core/Formatter.cs +++ b/Core/Formatter.cs @@ -1264,7 +1264,7 @@ namespace ScrewTurn.Wiki { sb.Replace("\n\n", "

"); - sb.Replace(SingleBrPlaceHolder, "

"); + sb.Replace(SingleBrPlaceHolder, "\n");//Replace

with
}