示例#1
0
        public void GetNodeInfoTest()
        {
            string strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strParertName = "LayoutSetting";
            string strNodeName   = "SetingInfo";
            string strKeyName    = "key";
            string strResult     = XmlUse.GetNodeInfo(strFilePath, strParertName, strNodeName, strKeyName);

            Assert.AreEqual(strResult, "123");
        }
示例#2
0
        public void GetNodeIofoTest()
        {
            string strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strParertName = "LayoutSetting";
            string strNodeName   = "SetingInfo123123";

            string[] strsField = new string[] { "key", "value", "defaultvalue" };
            string[] strsValue = new string[] { "123", "123", "123" };
            XmlNode  node      = XmlUse.GetNodeInfo(strFilePath, strParertName, strNodeName);

            Assert.AreEqual(node.Attributes["key"].Value, "1");
        }
示例#3
0
        public void UpdateNodeInfoTest2()
        {
            string  strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string  strParertName = "LayoutSetting";
            string  strNodeName   = "SetingInfo";
            XmlNode node          = XmlUse.GetNodeInfo(strFilePath, strParertName, strNodeName);
            //node.Attributes.Append(new XmlAttribute)
            XmlElement element = (XmlElement)node;

            element.SetAttribute("TestAttr", "TestAttrValue");
            bool bolResult = XmlUse.UpdateNodeInfo(strFilePath, strParertName, node);

            Assert.IsTrue(bolResult);
        }