public virtual void testIFBoolean()
        {
            StringTemplateGroup group = new StringTemplateGroup("dummy", ".");
            StringTemplate t = new StringTemplate(group, "$if(b)$x$endif$ $if(!b)$y$endif$");
            t.setAttribute("b", true);
            Assert.AreEqual(t.ToString(), "x ");

            t = t.getInstanceOf();
            t.setAttribute("b", false);
            Assert.AreEqual(t.ToString(), " y");
        }
        public virtual void testEmbeddedMultiLineIF()
        {
            StringTemplateGroup group = new StringTemplateGroup("test");
            StringTemplate main = new StringTemplate(group, "$sub$");
            StringTemplate sub = new StringTemplate(group, "begin" + newline + "$if(foo)$" + newline + "$foo$" + newline + "$else$" + newline + "blort" + newline + "$endif$" + newline);
            sub.setAttribute("foo", "stuff");
            main.setAttribute("sub", sub);
            String expecting = "begin" + newline + "stuff";
            Assert.AreEqual(main.ToString(), expecting);

            main = new StringTemplate(group, "$sub$");
            sub = sub.getInstanceOf();
            main.setAttribute("sub", sub);
            expecting = "begin" + newline + "blort";
            Assert.AreEqual(main.ToString(), expecting);
        }
        public virtual void testDumpMapAndSet()
        {
            StringTemplate st = new StringTemplate("$items; separator=\",\"$");
            IDictionary m = new Hashtable();
            m["a"] = "1";
            m["b"] = "2";
            m["c"] = "3";
            st.setAttribute("items", m);
            String expecting = "1,2,3";
            Assert.AreEqual(st.ToString(), expecting);

            st = st.getInstanceOf();
            IDictionary s = new Hashtable();
            s.Add("1", null);
            s.Add("2", null);
            s.Add("3", null);
            st.setAttribute("items", s.Keys);
            expecting = "2,3,1";
            Assert.AreEqual(st.ToString(), expecting);
        }
        public virtual void testElseClause()
        {
            StringTemplate e = new StringTemplate("$if(title)$" + newline + "foo" + newline + "$else$" + newline + "bar" + newline + "$endif$");
            e.setAttribute("title", "sample");
            String expecting = "foo";
            Assert.AreEqual(e.ToString(), expecting);

            e = e.getInstanceOf();
            expecting = "bar";
            Assert.AreEqual(e.ToString(), expecting);
        }
        public virtual void testApplyAnonymousTemplateToMapAndSet()
        {
            StringTemplate st = new StringTemplate("$items:{<li>$it$</li>}$");
            IDictionary m = new Hashtable();
            m["a"] = "1";
            m["b"] = "2";
            m["c"] = "3";
            st.setAttribute("items", m);
            String expecting = "<li>1</li><li>2</li><li>3</li>";
            Assert.AreEqual(st.ToString(), expecting);

            st = st.getInstanceOf();
            IDictionary s = new Hashtable();
            s.Add("1", null);
            s.Add("2", null);
            s.Add("3", null);
            st.setAttribute("items", s.Keys);
            expecting = "<li>2</li><li>3</li><li>1</li>";
            Assert.AreEqual(st.ToString(), expecting);
        }