예제 #1
0
        public bool Test(out string results)
        {
            string template =
                @"{@nested {=title:}{@demographics
Name      {=Name:}
Country   {=Country:}
Christian {=Christian:}:}:}";

            string expected =
                @"This is a test for template nesting.
Name      Xecronix 1
Country   Unknown 1
Christian Yes 1
Name      Xecronix 2
Country   Unknown 2
Christian Yes 2
Name      Xecronix 3
Country   Unknown 3
Christian Yes 3";

            SharpEagle.Template eagle = new SharpEagle.Template();
            eagle.AddAction("nested", this);
            Dictionary <string, string> tags = new Dictionary <string, string>();

            results = eagle.Parse(template, tags);
            bool retval = expected.Equals(results);

            return(retval);
        }
예제 #2
0
        public string Run(string template, Dictionary <string, string> tags)
        {
            SharpEagle.Template eagle = new SharpEagle.Template();
            eagle.AddAction("demographics", new DemographicsAction());
            Dictionary <string, string> newTags = new Dictionary <string, string>();

            newTags.Add("title", "This is a test for template nesting.");
            string retval = eagle.Parse(template, newTags).Trim();

            return(retval);
        }
예제 #3
0
        public bool Test(out string results)
        {
            string template =
                @"{@nested {=title:}:}
{@multiaction1{=sub:}:}";

            string expected =
                @"Multiple Sequential Action Test.
MultiAction1 TEXT";

            SharpEagle.Template eagle = new SharpEagle.Template();
            eagle.AddAction("nested", this);
            eagle.AddAction("multiaction1", new MultiAction1());
            Dictionary <string, string> tags = new Dictionary <string, string>();

            results = eagle.Parse(template, tags);
            bool retval = expected.Equals(results);

            return(retval);
        }
예제 #4
0
        public bool Test(out string results)
        {
            bool   pass     = true;
            string template = "This is a {@action{=descr:}:} test!";
            Dictionary <string, string> tags = new Dictionary <string, string>();

            SharpEagle.Template eagle = new SharpEagle.Template();
            eagle.AddAction("action", this);
            string result   = eagle.Parse(template, tags);
            string expected = "This is a cool test!";

            if (result != expected)
            {
                results = string.Format("SimpleSubstitutionTest: Result [{0}] is not [{1}]", result, expected);
                pass    = false;
            }
            else
            {
                results = "PASS";
            }
            return(pass);
        }