using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; namespace ScrewTurn.Wiki.Tests { [TestFixture] public class ReverseFormatterTests { [Test] [TestCase("text", "'''text'''")] [TestCase("text", "'''text'''")] [TestCase("text", "''text''")] [TestCase("text", "''text''")] [TestCase("text", "__text__")] [TestCase("text", "--text--")] [TestCase("

text

", "==text==")] [TestCase("

text

", "===text===")] [TestCase("

text

", "====text====")] [TestCase("

text", "=====text=====")] [TestCase("text", "text")] [TestCase("text", "text")] [TestCase("
text
", "@@text@@")] [TestCase("text", "{{'''text'''}}")] [TestCase("
text
", "(((text)))\r\n")] [TestCase("
text
", "\r\ntext\r\n")] [TestCase("riga1\r\nriga2\r\nriga3","riga1\r\n'''riga2'''\r\nriga3")] [TestCase("
  1. 1
  2. 2
  3. 3
    1. 3.1
    2. 3.2
      1. 3.2.1
    3. 3.3
  4. 4

", "# 1\r\n# 2\r\n# 3\r\n## 3.1\r\n## 3.2\r\n### 3.2.1\r\n## 3.3\r\n# 4\r\n\r\n\r\n")] [TestCase("
  1. 1
  2. 2
", "# 1\r\n# 2\r\n")] [TestCase("", "* 1\r\n* 2\r\n")] [TestCase("", "* Punto 1\r\n* Punto 2\r\n* Punto 3\r\n* Punto 4\r\n* Punto 5\r\n")] [TestCase("", "* it 1\r\n** 1.1\r\n** 1.2\r\n* it2\r\n")] [TestCase("", "* it 1\r\n*# 1.1\r\n*# 1.2\r\n* it2\r\n")] [TestCase("", "* '''1'''\r\n* 2\r\n")] [TestCase("I'm an anchor", "[anchor|#init]I'm an anchor")] [TestCase("This recall an anchor", "[#init|This recall an anchor]")] [TestCase("BIG TITLE", "[^google.com|BIG TITLE]")] [TestCase("try to esc tag", "try to esc tag")] [TestCase("
\"left

leftalign

", "[imageleft|leftalign|{UP(MainPage)}image.png|^www.link.com]\r\n")] [TestCase("\"inlineimage\"", "[image||{UP(MainPage)}image.png]\r\n")] [TestCase("\"description\"", "[image||{UP(MainPage)}image.png|^www.google.it]\r\n")] [TestCase("
\"autoalign\"

autoalign

", "[imageauto|autoalign|{UP(MainPage)}image.png]\r\n")] [TestCase("
\"Auto

Auto align

", "[imageauto||{UP(MainPage)}image.png|www.link.com]\r\n")] public void PlainTest(string input, string output) { Assert.AreEqual(output, ReverseFormatter.ReverseFormat(input)); } } }