Exemplo n.º 1
0
        public void TestPlaceHolderVariableArgUnknownSubstitution()
        {
            var variable = new PlaceHolderVariable();
            var template = variable.ToString("UNKNOWN");

            var engine = new TemplateEngine(template);

            engine.AddVariable(variable);

            var dynCtx = new Dictionary <string, object>();

            engine.ToString(dynCtx);
        }
Exemplo n.º 2
0
        public void TestPlaceHolderVariableArgNameSubstitution()
        {
            var variable = new PlaceHolderVariable();
            var template = variable.ToString(PlaceHolderVariable.ArgName);

            var engine = new TemplateEngine(template);

            engine.AddVariable(variable);

            var placeHolderFile = new FileInfo(PathUtil.Combine("path", "to", "placeholder", ".emptydir"));
            var dynCtx          = new Dictionary <string, object>();

            dynCtx[PlaceHolderVariable.ContextPlaceHolderFile] = placeHolderFile;

            var str = engine.ToString(dynCtx);

            Console.WriteLine(string.Format("SUBSTITUTED STRING: '{0}'", str));

            Assert.AreEqual(placeHolderFile.Name, str);
        }