public void Register() { PlaceholderEngine engine = new PlaceholderEngine(); engine.Register("double", d => d + d); Assert.AreEqual("aa", engine.Transform("[double:a]")); }
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); }
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)); }