Example #1
0
 public void testContentReader()
 {
     HTMLInfo htmlinfo = new HTMLInfo();
        string html=htmlinfo.GetHTMLInfo("首页","","");
        string oldhtml="<div>这是测试首页<p>测试测试测试测试测试</p></div>";
        Assert.IsTrue(File.Exists(ConfigurationManager.AppSettings["HTMLInfoPath"].ToString()+"首页" + ".html"));
        Assert.AreEqual(oldhtml, html);
        html = htmlinfo.GetHTMLInfo("景区", "西湖","订票说明");
        oldhtml = "<p>这是一个西湖订票说明页面s</p>";
        Assert.IsTrue(File.Exists(ConfigurationManager.AppSettings["HTMLInfoPath"].ToString() +"西湖_订票说明"+".html"));
        Assert.AreEqual(oldhtml, html);
 }
Example #2
0
 public void testContentWriter()
 {
     HTMLInfo htmlinfo = new HTMLInfo();
     htmlinfo.WriteHTMLInfo("测试", null, null, "<div>这是测试测试测试测试测试</div>");
     //由于这文件事先不存在,先验证是否存在
     Assert.IsTrue(File.Exists(ConfigurationManager.AppSettings["HTMLInfoPath"].ToString() + "测试" + ".html"));
     string oldhtml = "<div>这是测试测试测试测试测试</div>";
     string html = htmlinfo.GetHTMLInfo("测试", null, null);
     Assert.AreEqual(oldhtml, html);
     //文件存在后,修改其内容
     htmlinfo.WriteHTMLInfo("测试", null, null, "<div>这是新的新的新的新的新的新的</div>");
     oldhtml = "<div>这是新的新的新的新的新的新的</div>";
     html = htmlinfo.GetHTMLInfo("测试", null, null);
     Assert.AreEqual(oldhtml, html);
 }
Example #3
0
 protected override void Render(HtmlTextWriter output)
 {
     HTMLInfo htmlinfo = new HTMLInfo();
     string outputstr = htmlinfo.GetHTMLInfo(type, scname, scFuncType);
     if (string.IsNullOrEmpty(outputstr))
     {
         outputstr = BaseData;
         htmlinfo.WriteHTMLInfo(type, scname, scFuncType, BaseData);
     }
     if (CanEdit)
     {
         output.AddAttribute("onmouseover", "EditHTMLInfo(this)");
         output.AddAttribute("onmouseout", "CancelHTMLInfo(this,'"+HasBorder+"')");
         output.AddAttribute("ondblclick", "EditHTMLInfoBtn(this,'"+type+"','" + scname + "','" + scFuncType + "')");
         output.AddAttribute("class", CssClass);
         output.AddAttribute("id", ID);
         output.RenderBeginTag(HtmlTextWriterTag.Div);
         output.Write(outputstr);
         output.RenderEndTag();
     }
     else
     {
         output.AddAttribute("class", CssClass);
         output.AddAttribute("id", ID);
         output.RenderBeginTag(HtmlTextWriterTag.Div);
         output.Write(outputstr);
         output.RenderEndTag();
     }
 }