示例#1
0
        public void CountyHasMoreThanTwoValue()
        {
            var options = new
            {
                County = new[] { "Kane", "Salt Lake", "Weber" }
            };

            var actual = Handlebars.Render(Template, options);

            Assert.That(actual, Is.EqualTo("Kane, Salt Lake and Weber"));
        }
示例#2
0
 public string Each(string input)
 {
     return(Handlebars.Render(input, new
     {
         items = new[]
         {
             new { val = "A" },
             new { val = "B" }
         }
     }));
 }
示例#3
0
        public void CountyHasOneValue()
        {
            var options = new
            {
                County = new[] { "Kane" }
            };

            var actual = Handlebars.Render(Template, options);

            Assert.That(actual, Is.EqualTo("Kane"));
        }
示例#4
0
        public void WriteOperators()
        {
            ConsoleLogger logger = new ConsoleLogger();

            Handlebars.HandlebarsDirectory = new HandlebarsDirectory("./Templates", logger);
            string fileName = "./tmp.txt";

            foreach (string dataType in new string[] { "int", "uint", "ulong", "long", "decimal", "int?", "uint?", "ulong?", "decimal?", "string", "DateTime", "DateTime?" })
            {
                string result = Handlebars.Render("operators", new { DataType = dataType });
                result.SafeAppendToFile("./operators.txt");
                result = Handlebars.Render("generic-operators", new { DataType = dataType });
                result.SafeAppendToFile("./generic-operators.txt");
                Message.PrintLine("Wrote file {0}", new FileInfo(fileName).FullName);
            }
        }
示例#5
0
 public string With(string input)
 {
     return(Handlebars.Render(input, new { item = new { val = "test" } }));
 }
示例#6
0
 public string Unless(string input, object value)
 {
     return(Handlebars.Render(input, new { val = value }));
 }
示例#7
0
 public string Escaping(string input, string value)
 {
     return(Handlebars.Render(input, new { value }));
 }
示例#8
0
 public string Simple(string input)
 {
     return(Handlebars.Render(input, new { value = "test" }));
 }