Example #1
0
        public void TestGetTemplateNames()
        {
            string templates =
                "t() ::= \"foo\"\n" +
                "main() ::= \"<t()>\"";
            writeFile(tmpdir, "t.stg", templates);

            TemplateGroup group = new TemplateGroupFile(tmpdir + "/t.stg");
            // try to get an undefined template.
            // This will add an entry to the "templates" field in STGroup, however
            // this should not be returned.
            group.LookupTemplate("t2");

            HashSet<string> names = group.GetTemplateNames();

            // Should only contain "t" and "main" (not "t2")
            Assert.AreEqual(2, names.Count);
            CollectionAssert.Contains(names.ToList(), "/t");
            CollectionAssert.Contains(names.ToList(), "/main");
        }