Пример #1
0
        public void TestTemplateParser_MessyData_ReturnFixedTemplate()
        {
            IStringTemplateParser parser   = new StringTemplateParser();
            IStringTemplate       template = parser.Parse(messyTemplateData, StringTemplateParserOption.FixMalformedTemplate);

            Assert.AreEqual(templateData, template.Template);
            Assert.AreEqual(1, template.Parameters.Length);
            Assert.AreEqual(templateVarName, template.Parameters[0].Name);

            IStringTemplateProcessor processor = new StringTemplateProcessor();
            var a = processor.Process(template, templateVarValue);

            Assert.AreEqual(expected_result, a);
        }
Пример #2
0
        public void TestTemplateParser_ReturnValidTemplate()
        {
            IStringTemplateParser parser   = new StringTemplateParser();
            IStringTemplate       template = parser.Parse(templateData);

            Assert.AreEqual(templateData, template.Template);
            Assert.AreEqual(1, template.Parameters.Length);
            Assert.AreEqual(templateVarName, template.Parameters[0].Name);

            IStringTemplateProcessor processor = new StringTemplateProcessor();
            var a = processor.Process(template, templateVarValue);

            Assert.AreEqual(expected_result, a);
        }