public virtual void testReflectionWithMap()
 {
     StringTemplate.setLintMode(true);
     StringTemplate a = new StringTemplate("$attributes$");
     StringTemplateErrorListener errors = new ErrorBuffer();
     a.setErrorListener(errors);
     Hashtable map = new Hashtable();
     a.setAttribute("stuff", map);
     map["prop1"] = "Terence";
     map["prop2"] = new R3();
     String results = a.ToString();
     //System.out.println(results);
     String expecting = "Template anonymous:" + newline +
     "    1. Attribute stuff values:" + newline +
     "        1. Key prop1 : String" + newline +
     "        2. Key prop2 : TestStringTemplate+R3" + newline +
     "            1. Property anotherMap : Hashtable" + newline +
     "            2. Property aMap : IDictionary" + newline +
     "                1. Key v : String" + newline +
     "            3. Property email : String" + newline;
     StringTemplate.setLintMode(false);
     Assert.AreEqual(results, expecting);
 }
 public virtual void testReflectionRecursive()
 {
     StringTemplate.setLintMode(true);
     StringTemplate a = new StringTemplate("$attributes$");
     StringTemplateErrorListener errors = new ErrorBuffer();
     a.setErrorListener(errors);
     a.setAttribute("name", "Terence");
     a.setAttribute("name", "Tom");
     StringTemplate b = new StringTemplate("embedded template text");
     b.setName("EmbeddedTemplate");
     b.setAttribute("x", 1);
     b.setAttribute("y", "foo");
     a.setAttribute("name", b);
     a.setAttribute("name", new R1());
     a.setAttribute("duh", "foo");
     String results = a.ToString();
     //System.out.println(results);
     String expecting = "Template anonymous:" + newline +
         "    1. Attribute duh values:" + newline +
         "        1. String" + newline +
         "    2. Attribute name values:" + newline +
         "        1. String" + newline +
         "        2. String" + newline +
         "        3. Template EmbeddedTemplate:" + newline +
         "            1. Attribute x values:" + newline +
         "                1. Int32" + newline +
         "            2. Attribute y values:" + newline +
         "                1. String" + newline +
         "        1. Property subAggregate : TestStringTemplate+R2" + newline +
         "            1. Property email : String" + newline +
         "        2. Property subTemplate : StringTemplate" + newline +
         "            2. Template a template created in R1:" + newline +
         "                1. Attribute nestedAggr values:" + newline +
         "                2. Attribute fruit values:" + newline +
         "                    1. String" + newline +
         "        3. Property lastName : String" + newline +
         "        4. Property firstName : String" + newline;
         StringTemplate.setLintMode(false);
     Assert.AreEqual(results, expecting);
 }
 public virtual void testReflectionTypeLoop()
 {
     StringTemplate.setLintMode(true);
     StringTemplate a = new StringTemplate("$attributes$");
     StringTemplateErrorListener errors = new ErrorBuffer();
     a.setErrorListener(errors);
     a.setAttribute("name", "Terence");
     a.setAttribute("c", new C());
     a.setAttribute("a", new A());
     String results = a.ToString();
     //System.out.println(results);
     String expecting = "Template anonymous:" + newline +
         "    1. Attribute a values:" + newline +
         "        1. Property b : TestStringTemplate+B" + newline +
         "            1. Property harmless1 : String" + newline +
         "            2. Property a : TestStringTemplate+A" + newline +
         "    2. Attribute name values:" + newline +
         "        1. String" + newline +
         "    3. Attribute c values:" + newline +
         "        1. Property harmless2 : String" + newline +
         "        2. Property self : TestStringTemplate+C" + newline;
     StringTemplate.setLintMode(false);
     Assert.AreEqual(results, expecting);
 }
 public virtual void testReflection()
 {
     StringTemplate.setLintMode(true);
     StringTemplate a = new StringTemplate("$attributes$");
     StringTemplateErrorListener errors = new ErrorBuffer();
     a.setErrorListener(errors);
     a.setAttribute("name", "Terence");
     a.setAttribute("name", "Tom");
     StringTemplate embedded = new StringTemplate("embedded");
     embedded.setAttribute("z", "hi");
     a.setAttribute("name", embedded);
     a.setAttribute("notUsed", "foo");
     String expecting = "Template anonymous:" + newline +
         "    1. Attribute notUsed values:" + newline +
         "        1. String" + newline +
         "    2. Attribute name values:" + newline +
         "        1. String" + newline +
         "        2. String" + newline +
         "        3. Template anonymous:" + newline +
         "            1. Attribute z values:" + newline +
         "                1. String" + newline;
     a.setPredefinedAttributes();
     String results = a.ToString();
     //System.out.println(results);
     StringTemplate.setLintMode(false);
     Assert.AreEqual(results, expecting);
 }