Exemple #1
0
 public void ReplaceSingleLetterVariables()
 {
     Assert.AreEqual(Cheetah.Replace("%x", "x", "y", "%"), "y");
     Assert.AreEqual(Cheetah.Replace("$x", "x", "y", "$"), "y");
     Assert.AreEqual(Cheetah.Replace("x%xxx%xx", "x", "y"), "xyxxyx");
     Assert.AreEqual(Cheetah.Replace("%%%xx%%", "x", "y"), "%%yx%%");
 }
Exemple #2
0
 public void ReplaceWordVariables()
 {
     Assert.AreEqual(Cheetah.Replace("%bar", "bar", "fooo", "%"), "fooo");
     Assert.AreEqual(Cheetah.Replace("$bar", "bar", "fooo", "$"), "fooo");
     Assert.AreEqual(Cheetah.Replace("bar%barbarb%arba%r%barbar", "bar", "fooo"), "barfooobarb%arba%rfooobar");
     Assert.AreEqual(Cheetah.Replace("%%%barbar%%", "bar", "fooo"), "%%fooobar%%");
 }
Exemple #3
0
        public void ReplaceVariablesButSecondIsMissing()
        {
            string input    = "%LEVEL  %NAME-value PIC X VALUE LOW-VALUE.\n  88  %NAME       VALUE 'T'.\n  88  %NAME-false VALUE 'F'.";
            string expected = "01  %NAME-value PIC X VALUE LOW-VALUE.\n  88  %NAME       VALUE 'T'.\n  88  %NAME-false VALUE 'F'.";

            Assert.AreEqual(Cheetah.Replace(input, new Dictionary <string, string>()
            {
                { "LEVEL", "01" }
            }, "%"), expected);
        }