/// <summary> /// 返回消息 /// </summary> private string Return(string code, string message) { var xml = new Xml(); xml.AddCDataNode(code, WechatpayConst.ReturnCode); xml.AddCDataNode(message, WechatpayConst.ReturnMessage); return(xml.ToString()); }
/// <summary> /// 添加Xml节点 /// </summary> private void AddNode(Xml xml, string key, object value) { if (key.SafeString().ToLower() == WechatpayConst.TotalFee) { xml.AddNode(key, value); return; } xml.AddCDataNode(value, key); }
public void TestAddCDataNode_1() { //结果 var result = new String(); result.Append("<xml>"); result.Append("<![CDATA[1]]>"); result.Append("</xml>"); //操作 _xml.AddCDataNode("1"); //验证 Assert.Equal(result.ToString(), _xml.ToString()); //输出结果 _output.WriteLine(_xml.ToString()); }