示例#1
0
        public async Task TestCustomHost()
        {
            var gen = new CustomHost {
                TestProperty = 3
            };

            gen.Refs.Add(typeof(CustomHost).Assembly.Location);
            gen.Imports.Add("Mono.TextTemplating.Tests");

            var outFilename = "test.txt";
            var result      = await gen.ProcessTemplateAsync(
                "test.tt",
                "<#@ template hostspecific=\"true\" #><#= ((TextTemplatingSessionTests.CustomHost)Host).TestProperty * 5 #>",
                outFilename
                );

            Assert.True(result.success);
            Assert.Equal("15", result.content);
        }