Пример #1
0
        public async Task Render()
        {
            var options = new LiquidOptions();

            var parser   = new LiquidParser(new OptionsWrapper <LiquidOptions>(options));
            var template = parser.Parse("{% render 'header' %}");

            var root = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "Scripting\\Liquid");

            var context = new TemplateContext(options)
            {
                Options =
                {
                    FileProvider = new PhysicalFileProvider(root)
                }
            };
            var rendered = await template.RenderAsync(context);

            Assert.Equal("<h2>YES</h2>", rendered);
        }