예제 #1
0
        public void CanUpdateTemplateWithCollection()
        {
            string templateText = "ponemos mas fruta |$EmailDataTest.Rows[N].Column$| ponemos mas fruta |$EmailDataTest.Rows[N].Column$| END";
            string finalText    = "ponemos mas fruta 12345 ponemos mas fruta 12345 END";

            EmailDataTest t = new EmailDataTest();

            t.Rows = new List <EmailRowTest>();
            t.Rows.Add(new EmailRowTest {
                Column = "1"
            });
            t.Rows.Add(new EmailRowTest {
                Column = "2"
            });
            t.Rows.Add(new EmailRowTest {
                Column = "3"
            });
            t.Rows.Add(new EmailRowTest {
                Column = "4"
            });
            t.Rows.Add(new EmailRowTest {
                Column = "5"
            });

            string newText = RegExpTemplatorHelper.SetObjectProperties(templateText, t);

            Assert.IsTrue(newText == finalText, newText);
        }
예제 #2
0
        public void CanUpdateTemplateWithValueObject()
        {
            string templateText = "Texto == $data$";
            string finalText    = "Texto == Texto";
            string textValue    = "Texto";

            string newText = RegExpTemplatorHelper.SetObjectProperties(templateText, textValue);

            Assert.IsTrue(newText == finalText, newText);
        }
예제 #3
0
        public void CanUpdateTemplateWithStandardObject()
        {
            string templateText = "1 == $EmailRowTest.Column$ y ademas 2 == $EmailRowTest.ColumnChild.Column$";
            string finalText    = "1 == 1 y ademas 2 == 2";

            EmailRowTest child = new EmailRowTest()
            {
                Column = "2"
            };
            EmailRowTest ert = new EmailRowTest
            {
                Column      = "1",
                ColumnChild = child
            };

            string newText = RegExpTemplatorHelper.SetObjectProperties(templateText, ert);

            Assert.IsTrue(newText == finalText, newText);
        }