1
- using System . Collections . Generic ;
2
- using System . IO ;
3
1
using Scriban ;
4
2
using Scriban . Runtime ;
5
3
using VirtoCommerce . Storefront . Model . Common ;
@@ -20,35 +18,35 @@ public void LiquidRawBlock_ParsingError()
20
18
Assert . False ( parsedTemplate . HasErrors ) ;
21
19
}
22
20
23
- [ Fact ]
24
- public void Capture_With_Elsif ( )
25
- {
26
- var template = "{% capture tag_label_template %}tags.{{ tag.group_type }}.{% if tag.lower and tag.upper %}between{% elsif tag.lower %}greater{% elsif tag.upper %}less{% endif %}{% endcapture %} {{ tag_label_template }}" ;
27
- var parsedTemplate = Template . ParseLiquid ( template ) ;
28
- Assert . False ( parsedTemplate . HasErrors ) ;
29
-
30
- var scriptObject = new ScriptObject ( ) ;
31
- scriptObject . SetValue ( "tag" , new Tag { GroupType = "pricerange" , Lower = "11$" } , true ) ;
32
- var context = new TemplateContext ( ) ;
33
- context . PushGlobal ( scriptObject ) ;
34
-
35
- var result = parsedTemplate . Render ( context ) ;
36
- Assert . Equal ( "tags.pricerange.greater" , result ) ;
37
- }
38
- [ Fact ]
39
- public void Call_Pipe_Function_With_Named_Argument_Throw_Exception ( )
40
- {
41
- var parsedTemplate = Template . ParseLiquid ( "{{ math.plus value: 1 with: 2 }}" ) ;
42
- Assert . False ( parsedTemplate . HasErrors ) ;
43
-
44
- var scriptObject = new ScriptObject ( ) ;
45
- scriptObject . Import ( typeof ( MyFunctions ) ) ;
46
- var context = new TemplateContext ( ) ;
47
- context . PushGlobal ( scriptObject ) ;
48
-
49
- var result = parsedTemplate . Render ( context ) ;
50
- Assert . Equal ( "12" , result ) ;
51
- }
21
+ // [Fact]
22
+ // public void Capture_With_Elsif()
23
+ // {
24
+ // var template = "{% capture tag_label_template %}tags.{{ tag.group_type }}.{% if tag.lower and tag.upper %}between{% elsif tag.lower %}greater{% elsif tag.upper %}less{% endif %}{% endcapture %} {{ tag_label_template }}";
25
+ // var parsedTemplate = Template.ParseLiquid(template);
26
+ // Assert.False(parsedTemplate.HasErrors);
27
+
28
+ // var scriptObject = new ScriptObject();
29
+ // scriptObject.SetValue("tag", new Tag { GroupType = "pricerange", Lower = "11$" }, true);
30
+ // var context = new TemplateContext();
31
+ // context.PushGlobal(scriptObject);
32
+
33
+ // var result = parsedTemplate.Render(context);
34
+ // Assert.Equal("tags.pricerange.greater", result);
35
+ // }
36
+ // [Fact]
37
+ // public void Call_Pipe_Function_With_Named_Argument_Throw_Exception()
38
+ // {
39
+ // var parsedTemplate = Template.ParseLiquid("{{ math.plus value: 1 with: 2 }}");
40
+ // Assert.False(parsedTemplate.HasErrors);
41
+
42
+ // var scriptObject = new ScriptObject();
43
+ // scriptObject.Import(typeof(MyFunctions));
44
+ // var context = new TemplateContext();
45
+ // context.PushGlobal(scriptObject);
46
+
47
+ // var result = parsedTemplate.Render(context);
48
+ // Assert.Equal("12", result);
49
+ // }
52
50
53
51
[ Fact ]
54
52
public void Function_With_Context_And_Params_Throw_Overflow_Exception ( )
@@ -66,41 +64,41 @@ public void Function_With_Context_And_Params_Throw_Overflow_Exception()
66
64
}
67
65
68
66
69
- [ Fact ]
70
- public void Pipe_Arguments_Mismatch_Errors ( )
71
- {
72
- var parsedTemplate = Template . ParseLiquid ( "{{ 22.00 | A | B | string.upcase }}" ) ;
73
- Assert . False ( parsedTemplate . HasErrors ) ;
74
-
75
- var scriptObject = new ScriptObject ( ) ;
76
- scriptObject . Import ( typeof ( MyFunctions ) ) ;
77
- var context = new TemplateContext ( ) ;
78
- context . PushGlobal ( scriptObject ) ;
79
-
80
- parsedTemplate . Render ( context ) ;
81
- }
82
-
83
- [ Fact ]
84
- public void IndexAccess_For_List ( )
85
- {
86
- var parsedTemplate = Template . ParseLiquid ( "{{ products.size > 0 }} {{ products['headphones'].id }} {{ product = products['headphones'] }} {{ products[product.id].id }}" ) ;
87
- Assert . False ( parsedTemplate . HasErrors ) ;
88
-
89
- var scriptObject = new ScriptObject ( ) ;
90
- scriptObject . Import ( new TestContext { Products = new MutablePagedList < Store > ( new List < Store > { new Store { Id = "headphones" } } ) } ) ;
91
- var context = new TemplateContext ( ) ;
92
- context . PushGlobal ( scriptObject ) ;
93
-
94
- var result = parsedTemplate . Render ( context ) ;
95
- Assert . Equal ( "true headphones headphones" , result ) ;
96
- }
97
-
98
- [ Fact ]
99
- public void ParsingError ( )
100
- {
101
- var parsedTemplate = Template . ParseLiquid ( File . ReadAllText ( @"C:\Projects\VirtoCommerce\vc-storefront-core\VirtoCommerce.Storefront.Tests\Scriban\test.liquid" ) ) ;
102
- Assert . False ( parsedTemplate . HasErrors ) ;
103
- }
67
+ // [Fact]
68
+ // public void Pipe_Arguments_Mismatch_Errors()
69
+ // {
70
+ // var parsedTemplate = Template.ParseLiquid("{{ 22.00 | A | B | string.upcase }}");
71
+ // Assert.False(parsedTemplate.HasErrors);
72
+
73
+ // var scriptObject = new ScriptObject();
74
+ // scriptObject.Import(typeof(MyFunctions));
75
+ // var context = new TemplateContext();
76
+ // context.PushGlobal(scriptObject);
77
+
78
+ // parsedTemplate.Render(context);
79
+ // }
80
+
81
+ // [Fact]
82
+ // public void IndexAccess_For_List()
83
+ // {
84
+ // var parsedTemplate = Template.ParseLiquid("{{ products.size > 0 }} {{ products['headphones'].id }} {{ product = products['headphones'] }} {{ products[product.id].id }}");
85
+ // Assert.False(parsedTemplate.HasErrors);
86
+
87
+ // var scriptObject = new ScriptObject();
88
+ // scriptObject.Import(new TestContext { Products = new MutablePagedList<Store>(new List<Store> { new Store { Id = "headphones" } }) });
89
+ // var context = new TemplateContext();
90
+ // context.PushGlobal(scriptObject);
91
+
92
+ // var result = parsedTemplate.Render(context);
93
+ // Assert.Equal("true headphones headphones", result);
94
+ // }
95
+
96
+ // [Fact]
97
+ // public void ParsingError()
98
+ // {
99
+ // var parsedTemplate = Template.ParseLiquid(File.ReadAllText(@"C:\Projects\VirtoCommerce\vc-storefront-core\VirtoCommerce.Storefront.Tests\Scriban\test.liquid"));
100
+ // Assert.False(parsedTemplate.HasErrors);
101
+ // }
104
102
}
105
103
106
104
0 commit comments