public Template(string templateCode, TemplateGroup templateGroup, Type tokenizerType) { _templateCode = templateCode; _tokenizer = (Tokenizer)tokenizerType.GetConstructor(new Type[] { typeof(string) }).Invoke(new object[] { templateCode }); _parameters = new Dictionary<string, object>(); _templateGroup = templateGroup; }
static void Main(string[] args) { string groupContent = ReadEmbeddedResource("StringTemplateTester.resources.main.stg"); TestGroup = new TemplateGroup(groupContent); List<ITest> cases = new List<ITest>(); int cntPass = 0; int cntFail = 0; Console.WriteLine("Loading All test cases..."); foreach (Type t in LocateTypeInstances(typeof(ITest),typeof(Program).Assembly)) cases.Add((ITest)t.GetConstructor(Type.EmptyTypes).Invoke(new object[0])); Console.WriteLine("Loading test cases complete...Executing now"); foreach (ITest test in cases) { Console.WriteLine("Executing test case " + test.Name + "..."); if (test.InvokeTest()) { Console.WriteLine("Test case " + test.Name + " passed successfully"); cntPass++; } else { Console.WriteLine("Test case " + test.Name + " failed"); cntFail++; } } Console.WriteLine("Test case results:"); Console.WriteLine("Passes: " + cntPass.ToString()); Console.WriteLine("Fails: " + cntFail.ToString()); Console.WriteLine("Total cases: " + cases.Count.ToString()); Console.WriteLine("Hit enter to exit..."); Console.ReadLine(); }
public Template(TemplateGroup templateGroup, string templateCode) : this(templateCode, templateGroup) { }
public Template(string templateCode, TemplateGroup templateGroup) : this(templateCode,templateGroup,typeof(DefaultTokenizer)) { }
public Template(StreamReader reader,TemplateGroup templateGroup,Type tokenizerType) : this(reader.ReadToEnd(),templateGroup,tokenizerType) { reader.Close(); }
public Template(StreamReader reader,TemplateGroup templateGroup) : this(reader, templateGroup, typeof(DefaultTokenizer)) { }