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
", "text\r\n")]
[TestCase("- 1
- 2
- 3
- 3.1
- 3.2
- 3.2.1
- 3.3
- 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\r\n\r\n")]
[TestCase("- 1
- 2
", "# 1\r\n# 2\r\n\r\n")]
[TestCase("", "* 1\r\n* 2\r\n\r\n")]
[TestCase("- Punto 1
- Punto 2
- Punto 3
- Punto 4
- Punto 5
", "* Punto 1\r\n* Punto 2\r\n* Punto 3\r\n* Punto 4\r\n* Punto 5\r\n\r\n")]
[TestCase("", "* it 1\r\n** 1.1\r\n** 1.2\r\n* it2\r\n\r\n")]
[TestCase("", "* it 1\r\n*# 1.1\r\n*# 1.2\r\n* it2\r\n\r\n")]
[TestCase("", "* '''1'''\r\n* 2\r\n\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("
leftalign
", "[imageleft|leftalign|{UP(MainPage)}image.png|^www.link.com]\r\n")]
[TestCase("
", "[image|inlineimage|{UP(MainPage)}image.png]\r\n")]
[TestCase("
", "[image|description|{UP(MainPage)}image.png|^www.google.it]\r\n")]
[TestCase(" autoalign |
", "[imageauto|autoalign|{UP(MainPage)}image.png]\r\n")]
[TestCase(" Auto align |
", "[imageauto|Auto align|{UP(MainPage)}image.png|www.link.com]\r\n")]
public void PlainTest(string input, string output) {
Assert.AreEqual(output, ReverseFormatter.ReverseFormat(input));
}
}
}