public void TestReplace_TagById(string source, string expected) { var replacer = new HtmlDocumentReplacer(); var context = new DataContext(); replacer.ReplaceTagIds.Add(new ReplaceParameter("a1", "1{0:D6}")); context.StartFrom = 10; source = replacer.Replace(source, context); Assert.Equal(expected, source); }
public void TestReplace_TagByDictionary() { var replacer = new HtmlDocumentReplacer(); var context = new DataContext(); context.DataDictionary.AddValue("台北市", "dictionary"); replacer.ReplaceTagIds.Add(new ReplaceParameter("a1", "ignore")); var source = "<p id=\"a1\">台北市</p>"; var expected = "<p id=\"a1\">dictionary</p>"; source = replacer.Replace(source, context); Assert.Equal(expected, source); }