Esempio n. 1
0
            public void TestContains()
            {
                var mixed = new object[] { "hi", 1, TestEnum.First };

                Assert.True(ArrayFunctions.Contains(mixed, "hi"));
                Assert.True(ArrayFunctions.Contains(mixed, 1));
                Assert.True(ArrayFunctions.Contains(mixed, TestEnum.First));
                Assert.True(ArrayFunctions.Contains(mixed, "First"));
                Assert.True(ArrayFunctions.Contains(mixed, 100));
                TestParser.AssertTemplate("true", "{{ value | array.contains 'First' }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("true", "{{ value | array.contains 100 }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 'Second' }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 101 }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 'Third' }}", model: new ObjectModel {
                    Value = mixed
                });
            }
Esempio n. 2
0
 public void TestMathRandomError()
 {
     TestParser.AssertTemplate("text(1,4) : error : minValue must be greater than maxValue", "{{ math.random 11 10 }}");
 }
Esempio n. 3
0
 public void TestSliceAtError()
 {
     TestParser.AssertTemplate("text(1,17) : error : Invalid number of arguments `0` passed to `string.slice1` while expecting `2` arguments", "{{ string.slice1 }}");
 }
Esempio n. 4
0
 public void TestSortNoError()
 {
     TestParser.AssertTemplate("true", "{{ [1,2] || array.sort }}");
 }
Esempio n. 5
0
 public void TestLiquidWithAndArguments()
 {
     TestParser.AssertTemplate("tada : 1 + yoyo", "{% include 'with_arguments' with 'tada' var1: 1, var2: 'yoyo' %}", ScriptLang.Liquid);
 }
Esempio n. 6
0
 public void TestLiquidFor()
 {
     TestParser.AssertTemplate("for_product: Orange for_product: Banana for_product: Apple for_product: Computer for_product: Mobile Phone for_product: Table for_product: Sofa ", "{% include 'for_product' for products %}", ScriptLang.Liquid);
 }
Esempio n. 7
0
 public void TestLiquidArguments()
 {
     TestParser.AssertTemplate("1 + yoyo", "{% include 'arguments' var1: 1, var2: 'yoyo' %}", ScriptLang.Liquid);
 }
Esempio n. 8
0
 public void TestLiquidNull()
 {
     TestParser.AssertTemplate("", "{% include a %}", ScriptLang.Liquid);
 }
Esempio n. 9
0
 public void TestLiquidWith()
 {
     TestParser.AssertTemplate("with_product: Orange", "{% include 'with_product' with product %}", ScriptLang.Liquid);
 }
Esempio n. 10
0
 public void TestNested()
 {
     TestParser.AssertTemplate("This is a header body This is a body_detail This is a footer", "{{ include 'nested_templates' }}");
 }
Esempio n. 11
0
 public void TestRecursiveNested()
 {
     TestParser.AssertTemplate("56789", "{{ include 'recursive_nested_templates' 5 }}");
 }
Esempio n. 12
0
 public void TestProduct()
 {
     TestParser.AssertTemplate("product: Orange", "{{ include 'product' }}");
 }
Esempio n. 13
0
 public void TestArguments()
 {
     TestParser.AssertTemplate("1 + 2", "{{ include 'arguments' 1 2 }}");
 }
Esempio n. 14
0
 public void TestSimple()
 {
     TestParser.AssertTemplate("Test with a include yoyo", "Test with a include {{ include 'yoyo' }}");
 }
Esempio n. 15
0
 public void TestLiquidNull()
 {
     TestParser.AssertTemplate("", "{% include a %}", true);
 }
Esempio n. 16
0
 public void TestSortError()
 {
     TestParser.AssertTemplate("text(1,19) : error : Invalid number of arguments `0` passed to `array.sort` while expecting at least `1` arguments", "{{ [1,2] || array.sort }}");
 }