Ejemplo n.º 1
0
        public void Register()
        {
            PlaceholderEngine engine = new PlaceholderEngine();

            engine.Register("double", d => d + d);

            Assert.AreEqual("aa", engine.Transform("[double:a]"));
        }
Ejemplo n.º 2
0
        public void Basics()
        {
            string source      = Convert.ToString(TestContext.DataRow["source"]);
            string expected    = Convert.ToString(TestContext.DataRow["expected"]);
            string description = Convert.ToString(TestContext.DataRow["description"]);

            PlaceholderEngine engine = new PlaceholderEngine();

            Assert.AreEqual(expected, engine.Transform(source), description);
        }
Ejemplo n.º 3
0
        public void Labels()
        {
            IDictionary <string, string> labels = new Dictionary <string, string> {
                { "alpha", "Hello" },
                { "beta", "World" },
                { "Hello", "Nested" },
                { "Hello World", "Now that's just silly" },
                { "Hello:World", "Now that's just silly" },
            };

            PlaceholderEngine engine = new PlaceholderEngine();

            engine.Register("label", arg => labels.ContainsKey(arg) ? labels[arg] : null);
            string source   = Convert.ToString(TestContext.DataRow["source"]);
            string expected = Convert.ToString(TestContext.DataRow["expected"]);

            Assert.AreEqual(expected, engine.Transform(source));
        }