public void TestLinkParser() { Dictionary <string, string> index = new Dictionary <string, string> { { "link", "href" }, }; string input = "a@'link'@invalid"; string output = LinkParser.ResolveText((s) => { string item; if (index.TryGetValue(s, out item)) { return(item); } return(null); }, input, s => s); Assert.Equal("ahref@invalid", output); input = @"a@link @'link' @""link"""; output = LinkParser.ResolveText((s) => { string item; if (index.TryGetValue(s, out item)) { return(item); } return(null); }, input, s => "[link](" + s + ")"); Assert.Equal("a[link](href) [link](href) [link](href)", output); }
public void TestLinkParser() { Dictionary <string, string> index = new Dictionary <string, string> { { "link", "href" }, }; string input = "a@T:link-@invalid"; string output = LinkParser.ResolveText(index, input, s => s); Assert.AreEqual("ahref@invalid", output); input = "a@link @T:link-"; output = LinkParser.ResolveText(index, input, s => "[link](" + s + ")"); Assert.AreEqual("a[link](href) [link](href)", output); }