예제 #1
0
        public void ReportTemplateParserCorrectlySubstitutesVariables()
        {
            var parser = new ReportTemplateParser(new StringReader("Hello __name__, you are __this__"));

            parser.SetValue("name", "john");
            parser.SetValue("this", "here");
            Assert.IsTrue("Hello john, you are here".Equals(parser.Parse()));
        }
예제 #2
0
        public void ReportTemplateParserCorrectlyExtractsPrefilledInputAndReplacesIt()
        {
            var parser  = new ReportTemplateParser(new StringReader("Hello__ThisIsALongVariable__ __name:This is prefill__"));
            var prefill = parser.GetPrefill("name");

            Assert.AreEqual("This is prefill", prefill);
            parser.SetValue("ThisIsALongVariable", "asdf");
            parser.SetValue("name", prefill + ".");
            Assert.AreEqual("Helloasdf This is prefill.", parser.Parse());
        }