Exemple #1
0
        public void CanAddCustomBlock(string source, string expected)
        {
            var success = FluidTemplate2.TryParse(source, out var template, out var message);

            Assert.True(success, message.FirstOrDefault());

            var result = template.Render();

            Assert.Equal(expected, result);
        }
Exemple #2
0
        public void CanAddCustomTag(string source, string expected)
        {
            var context = new TemplateContext();

            context.SetValue("foo", "bar");

            var success = FluidTemplate2.TryParse(source, out var template);

            Assert.True(success);

            var result = template.Render(context);

            Assert.Equal(expected, result);
        }
Exemple #3
0
        public void IncludeTagsFlowTemplateType()
        {
            var source   = "A {% include 'test.liquid' %} B";
            var include  = "{% more '2' | append: 'pack' %}";
            var expected = "A here is some more 2pack B";

            var fileProvider = new MockFileProvider()
                               .Add("test.liquid", include);

            var context = new TemplateContext()
            {
                FileProvider = fileProvider
            };

            var success = FluidTemplate2.TryParse(source, out var template);

            Assert.True(success);

            var result = template.Render(context);

            Assert.Equal(expected, result);
        }