Пример #1
0
        public void TestTwoParam_Provided()
        {
            var template =
                @"string outside of check

@@@IFCHECK@@@
text inside ifcheck
@@@//IFCHECK@@@

@@@ANOTHERCHECK@@@
hello
line
another line
@@@//ANOTHERCHECK@@@";

            var expected =
                @"string outside of check

text inside ifcheck

hello
line
another line";

            var parser = new TestBaseClassParser(new List <string> {
                "IFCHECK", "ANOTHERCHECK"
            });

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }
Пример #2
0
        public void TestOneParam_IfElseIfElse()
        {
            var template =
                @"string outside of check

@@@IFCHECK@@@
text inside ifelsecheck
hello
line
@@@ELSE [IFCHECK]@@@
@@@ANOTHERCHECK@@@
another line
@@@//ANOTHERCHECK@@@
last line
@@@//IFCHECK@@@";

            var expected =
                @"string outside of check

last line";

            var parser = new TestBaseClassParser(new List <string>());

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }
Пример #3
0
        public void TestSixParam_SeveralNestedOrJoins_SomeProvided()
        {
            var template =
                @"string outside of check
@@@SUPERCHECK || HEROCHECK@@@
secret code
@@@IFCHECK || ANOTHERCHECK@@@
text inside ifelsecheck
hello
@@@INNERCHECK || SHAKEITCHECK@@@
line
@@@//INNERCHECK || SHAKEITCHECK@@@
another line
@@@//IFCHECK || ANOTHERCHECK@@@
@@@//SUPERCHECK || HEROCHECK@@@";

            var expected =
                @"string outside of check
secret code
text inside ifelsecheck
hello
line
another line";

            var parser = new TestBaseClassParser(new List <string> {
                "SUPERCHECK", "IFCHECK", "INNERCHECK", "SHAKEITCHECK"
            });

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }
Пример #4
0
        public void TestThreeParam_OneNestedAndJoin_OuterNotProvided()
        {
            var template =
                @"string outside of check
@@@SUPERCHECK@@@
secret code
@@@IFCHECK && ANOTHERCHECK@@@
text inside ifelsecheck
hello
line
another line
@@@//IFCHECK && ANOTHERCHECK@@@
@@@//SUPERCHECK@@@";

            var expected =
                @"string outside of check";

            var parser = new TestBaseClassParser(new List <string> {
                "IFCHECK", "ANOTHERCHECK"
            });

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }
Пример #5
0
        public void TestTwoParam_OneProvided_OneNotProvided_RemoveMultipleBlankLines()
        {
            var template =
                @"string outside of check

@@@IFCHECK@@@
text inside ifcheck
@@@//IFCHECK@@@

@@@ANOTHERCHECK@@@
hello
line
another line
@@@//ANOTHERCHECK@@@";

            var expected =
                @"string outside of check

hello
line
another line";

            var parseOptions = new BaseClassParseOptions
            {
                RemoveMultipleBlankLines = true
            };

            var parser = new TestBaseClassParser(new List <string> {
                "ANOTHERCHECK"
            }, parseOptions);

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }
Пример #6
0
        public void TestOneParam_NotProvided()
        {
            var template =
                @"string outside of check

@@@IFCHECK@@@
text inside ifcheck
@@@//IFCHECK@@@";

            var expected =
                @"string outside of check
";

            var parser = new TestBaseClassParser(new List <string>());

            var actual = parser.Parse(template);

            Assert.IsTrue(actual == expected, $"received: {actual}");
        }