public void Asterisks()
        {
            var cf = new Config();

            cf.boldSurround.customSurround = true;
            cf.boldSurround.customOpening  = "bo";
            cf.boldSurround.customClosing  = "bc";

            cf.italicSurround.customSurround = true;
            cf.italicSurround.customOpening  = "io";
            cf.italicSurround.customClosing  = "ic";

            cf.boldItalicSurround.customSurround = true;
            cf.boldItalicSurround.customOpening  = "xo";
            cf.boldItalicSurround.customClosing  = "xc";
            string quiz      = @"
**When** will **5argon** be able to *finish* his *music game* ***Mel Cadence***??
";
            string ans       = @"
boWhenbc will bo5argonbc be able to iofinishic his iomusic gameic xoMel Cadencexc??
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
Beispiel #2
0
        public void Surround()
        {
            var processed = TextProcessingLogic.Process("Hello| there is a | symbol", remainingSurroundConfig);

            Assert.That(processed,
                        Is.EqualTo(
                            "<style=\"mystyle\">Hello</style>haha<style=\"mystyle\"> there is a </style>haha<style=\"mystyle\"> symbol</style>"));
        }
Beispiel #3
0
 void QA(string question, string answer)
 {
     var config = new Config();
     var mbc = new ManualBreakingConfig();
     mbc.symbol = '|';
     config.manualBreakingConfig = mbc;
     var done = TextProcessingLogic.Process(question, config);
     Assert.That(done, Is.EqualTo(answer));
 }
Beispiel #4
0
        public void ListsAndBlockquotes()
        {
            var cf = new Config();

            cf.listSurround.customSurround       = true;
            cf.listSurround.customOpening        = "ol";
            cf.listSurround.customClosing        = "fl";
            cf.blockquoteSurround.customSurround = true;
            cf.blockquoteSurround.customOpening  = "ob";
            cf.blockquoteSurround.customClosing  = "fb";

            string quiz = @"
# Heading 1
# Heading 1
## Heading 2
## Heading 2
- Hi
- Yo
My - Name - Is - 5argon
- Nested - Inside
## Heading 2
### Heading 3
> Hey
### Heading 3
> Yo
> Nested > Inside
My > Name > Is > 5argon
#### Heading 4
#### Heading 4
#### Heading 4
";

            string ans       = @"
# Heading 1
# Heading 1
## Heading 2
## Heading 2
olHifl
olYofl
My - Name - Is - 5argon
olNested - Insidefl
## Heading 2
### Heading 3
obHeyfb
### Heading 3
obYofb
obNested > Insidefb
My > Name > Is > 5argon
#### Heading 4
#### Heading 4
#### Heading 4
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
Beispiel #5
0
        public void SymbolNotFound()
        {
            var processed = TextProcessingLogic.Process("Hello, no symbol", replaceConfig);

            Assert.That(processed, Is.EqualTo("Hello, no symbol"));

            var processed2 = TextProcessingLogic.Process("Hello, no symbol", remainingSurroundConfig);

            Assert.That(processed2, Is.EqualTo("Hello, no symbol"));
        }
        public void BoldMatchingItalicBold()
        {
            var cf = new Config();

            cf.boldSurround.customSurround = true;
            cf.boldSurround.customOpening  = "io";
            cf.boldSurround.customClosing  = "ic";
            string quiz      = @"
Should not ***match*** two times.
";
            string ans       = @"
Should not *iomatchic* two times.
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
        public void InlineCodeTest()
        {
            var cf = new Config();

            cf.inlineCodeSurround.customSurround = true;
            cf.inlineCodeSurround.customOpening  = "ico";
            cf.inlineCodeSurround.customClosing  = "icc";

            string quiz      = @"
**When** `will **5argon** be able to` *finish* his *music `game`* ***Mel Cadence***??
";
            string ans       = @"
**When** icowill **5argon** be able toicc *finish* his *music icogameicc* ***Mel Cadence***??
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
        public void ItalicMatchingBold()
        {
            var cf = new Config();

            cf.italicSurround.customSurround = true;
            cf.italicSurround.customOpening  = "io";
            cf.italicSurround.customClosing  = "ic";
            string quiz      = @"
Should not **match** two times.
";
            string ans       = @"
Should not *iomatchic* two times.
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            //The wrong one results in "ioicmatchioic".
            Assert.That(processed, Is.EqualTo(ans));
        }
        public void AsteriskPriority()
        {
            var cf = new Config();

            cf.boldSurround.customSurround   = true;
            cf.boldSurround.customOpening    = "bo";
            cf.boldSurround.customClosing    = "bc";
            cf.italicSurround.customSurround = true;
            cf.italicSurround.customOpening  = "io";
            cf.italicSurround.customClosing  = "ic";
            string quiz      = @"
Should not ***match*** two times.
";
            string ans       = @"
Should not iobomatchbcic two times.
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
Beispiel #10
0
        public void MultilineEverything()
        {
            var multilineEverything = new Config();
            var symbolConfig        = new SymbolConfig();

            symbolConfig.replace = true;
            symbolConfig.symbol  = '|';
            symbolConfig.remainingSurroundConfig.customSurround = true;
            symbolConfig.replaceWith = "z";
            symbolConfig.remainingSurroundConfig.customOpening = "<";
            symbolConfig.remainingSurroundConfig.customClosing = ">";
            multilineEverything.symbolConfigs = new[] { symbolConfig };

            var processed =
                TextProcessingLogic.Process("Mu|lti|line line 1.\nMul|tiline li|ne 2.", multilineEverything);

            Assert.That(processed,
                        Is.EqualTo(
                            "<Mu>z<lti>z<line line 1.>\n<Mul>z<tiline li>z<ne 2.>"));
        }
Beispiel #11
0
        public void Headings()
        {
            var cf = new Config();

            cf.heading4Surround.customSurround = true;
            cf.heading4Surround.customOpening  = "o4";
            cf.heading4Surround.customClosing  = "f4";
            cf.heading2Surround.customSurround = true;
            cf.heading2Surround.customOpening  = "o2";
            cf.heading2Surround.customClosing  = "f2";

            string quiz = @"
# Heading 1
# Heading 1
## Heading 2
## Heading 2
nope## Heading 2
### Heading 3
### Heading 3
nope#### Heading 4
#### Heading 4
#### Heading 4
";

            string ans       = @"
# Heading 1
# Heading 1
o2Heading 2f2
o2Heading 2f2
nope## Heading 2
### Heading 3
### Heading 3
nope#### Heading 4
o4Heading 4f4
o4Heading 4f4
";
            var    processed = TextProcessingLogic.Process(quiz, cf);

            Assert.That(processed, Is.EqualTo(ans));
        }
Beispiel #12
0
        public void Replace()
        {
            var processed = TextProcessingLogic.Process("Hello| there is a | symbol", replaceConfig);

            Assert.That(processed, Is.EqualTo("Hellohaha there is a haha symbol"));
        }