示例#1
0
        public void NameResetBuild()
        {
            StringTemplate st = "Let name = #{name};";

            st.Assign("name", "R");
            string result1 = st.Render();

            Assert.AreEqual("Let name = R;", result1);

            st.Assign("name", "X");
            string result2 = st.Render();

            Assert.AreEqual("Let name = X;", result2);
        }
示例#2
0
        public void TestEscape()
        {
            StringTemplate st = "##{test}#{case}";

            st.Assign("case", "1");
            Assert.AreEqual("#{test}1", st.Render());
        }
示例#3
0
        public void TestMissingNotAllow()
        {
            StringTemplate st = "[#{item1},#{item2}]";

            st.Assign("item1", "v1");
            string r = st.Render();
        }
示例#4
0
        public void TestMissingAllow()
        {
            StringTemplate st = "[#{item1},#{item2}]";

            st.Assign("item1", "v1");
            string r = st.Render(true);

            Assert.AreEqual("[v1,#{item2}]", r);
        }
示例#5
0
        public void NormalBuild()
        {
            StringTemplate st = "Let name = #{name};";

            st.Assign("name", "R");
            string result = st.Render();

            Assert.AreEqual("Let name = R;", result);
        }
示例#6
0
        public void TestClear()
        {
            StringTemplate st = "[#{item}]";

            st.Assign("item", "v");
            Assert.AreEqual("[v]", st.Render());

            st.Clear();
            Assert.AreEqual("[#{item}]", st.Render(true));
        }
示例#7
0
        public void TestAssignError()
        {
            StringTemplate st = "#{item}";

            st.Assign("v", "string");
        }