Exemple #1
0
        static void Main(string[] args)
        {
            using (IAtTemplate template = new AtTemplateProxy("recursive_list.txt", null, null))
            {
                template.Parse();
                template.Context = new object[] { 10 };

                Console.WriteLine(template.Render());
            }

            Console.ReadKey();
        }
Exemple #2
0
        public void AtTemplateProxy()
        {
            string generatedFile = null;

            using (IAtTemplate template = new AtTemplateProxy("1+1"))
            {
                template.Debug = true;
                template.Parse();
                template.Render();

                generatedFile = template.GeneratedAssemblyPath;
            }

            Assert.IsFalse(File.Exists(generatedFile));
        }
Exemple #3
0
        public void ProxyNewInstance()
        {
            using (IAtTemplate template = new AtTemplateProxy(
                       @"@global
int number = 1;
@end_global
@(number++)"))
            {
                template.Parse();

                Assert.AreEqual("1\r\n", template.Render());
                IAtTemplateInstance instance1 =
                    template.NewInstance();
                Assert.AreEqual("1\r\n", instance1.Render());
            }
        }