public void MigrationFileRenderStringTest()
        {
            var liquidTemplateRenderer = new LiquidTemplateRenderer();
            

            var templateContent = Templating.Templates.FluentMigrator.Resources.Template1;
            var expectedContent = Templating.Templates.FluentMigrator.Resources.Sample1;

            var content = liquidTemplateRenderer.Render(templateContent, sample1Model);

            Assert.AreEqual(expectedContent, content);

        }
        public void MigrationFileRenderStreamTest()
        {
            var liquidTemplateRenderer = new LiquidTemplateRenderer();

            var templateContent = Templating.Templates.FluentMigrator.Resources.Template1;
            var expectedContent = Templating.Templates.FluentMigrator.Resources.Sample1;
            string content = null;

            using (var output = new MemoryStream())
            {
                liquidTemplateRenderer.Render(templateContent, sample1Model);
                output.Seek(0, SeekOrigin.Begin);

                using (var streamReader = new StreamReader(output, true))
                {
                    content =  streamReader.ReadToEnd();
                }
            }

            content = liquidTemplateRenderer.Render(templateContent, sample1Model);

            Assert.AreEqual(expectedContent, content);

        }
예제 #3
0
        /// <summary>
        /// Renders the specified template content.
        /// </summary>
        /// <param name="templateContent">Content of the template.</param>
        /// <param name="model">The model.</param>
        /// <param name="output">The output stream</param>
        public void Render(string templateContent, object model, Stream output)
        {
            var template = Template.Parse(templateContent);

            template.Render(output, LiquidTemplateRenderer.BuildRenderParameters(model));
        }