示例#1
0
        public void TestForeachLoop()
        {
            string[] stuff    = { "Hello", "Hi", "Hey", "Goodbye", "ByeBye", "See ya" };
            string   expected = string.Join(",", stuff) + ",";

            TemplateUtil.EvaluateForeach(expected, "{stuff}", "{stuff},", new Dictionary <string, string>(), new Dictionary <string, IEnumerable <string> > {
                { "stuff", stuff }
            });
            TemplateUtil.EvaluateForeach(expected, "{stuff} IN (\"Hello\", \"Hi\", \"Hey\", \"Goodbye\", \"ByeBye\", \"See ya\")", "{stuff},", new Dictionary <string, string>(), new Dictionary <string, IEnumerable <string> >());
            TemplateUtil.EvaluateForeach(expected, "{s} IN {stuff}", "{s},", new Dictionary <string, string>(), new Dictionary <string, IEnumerable <string> > {
                { "stuff", stuff }
            });
        }