Exemple #1
0
        public void CreateXmlFileTest()
        {
            string strFilePath = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strRootName = "LayoutSetting";
            bool   bolResult   = XmlUse.CreateXmlFile(strFilePath, strRootName);

            Assert.IsTrue(bolResult);
        }
Exemple #2
0
        public void GetNodeInfo_ByElementTest()
        {
            string      strFilePath   = Environment.CurrentDirectory + "\\HostTypeInfo.xml";
            string      strParertName = "HostTypeInfo";
            string      strNodeName   = "HostType";
            XmlNodeList x             = XmlUse.GetNodeListInfo(strFilePath, strParertName, strNodeName);

            Assert.AreEqual(x.Count, 2);
        }
Exemple #3
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");
        }
Exemple #4
0
        public void UpdateNodeInfoTest()
        {
            string strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strParertName = "LayoutSetting";
            string strNodeName   = "SetingInfo1";
            string strField      = "key1";
            string strValue      = "123";
            bool   bolResult     = XmlUse.UpdateNodeInfo(strFilePath, strParertName, strNodeName, strField, strValue, true);

            Assert.IsTrue(bolResult);
        }
Exemple #5
0
        public void GetObjectInfoTest1()
        {
            string        strFilePath   = Environment.CurrentDirectory + "\\VideoTypeInfoSource.xml";
            string        strParertName = "VideoTypeInfoSource";
            string        strNodeName   = "VideoTypeInfo";
            XmlNodeList   x             = XmlUse.GetNodeListInfo(strFilePath, strParertName, strNodeName);
            XmlNode       node          = x[0];
            VideoTypeInfo result        = XmlUse.GetObjectInfo <VideoTypeInfo>(node);

            Assert.AreEqual(result.VideoTypeName, "1");
        }
Exemple #6
0
        public void GetObjectListInfoTest()
        {
            string      strFilePath   = Environment.CurrentDirectory + "\\HostTypeInfo.xml";
            string      strParertName = "HostTypeInfo";
            string      strNodeName   = "HostType";
            XmlNodeList x             = XmlUse.GetNodeListInfo(strFilePath, strParertName, strNodeName);

            List <HostType> result = XmlUse.GetObjectListInfo <HostType>(x);

            Assert.AreEqual(result.Count, 1);
        }
Exemple #7
0
        public void GetObjectInfoTest()
        {
            string       strFilePath   = Environment.CurrentDirectory + "\\EntranceTypeInfo.xml";
            string       strParertName = "EntranceTypeInfo";
            string       strNodeName   = "EntranceType";
            XmlNodeList  x             = XmlUse.GetNodeListInfo(strFilePath, strParertName, strNodeName);
            XmlNode      node          = x[0];
            EntranceType result        = XmlUse.GetObjectInfo <EntranceType>(node);

            Assert.AreEqual(result.Key1, "1");
        }
Exemple #8
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");
        }
Exemple #9
0
        public void UpdateNodeInfoTest1()
        {
            string strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strParertName = "LayoutSetting";
            string strNodeName   = "SetingInfo";

            string[] strsField = new string[] { "key", "value", "defaultvalue" };
            string[] strsValue = new string[] { "123", "123", "123" };
            bool     bolResult = XmlUse.UpdateNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);

            Assert.IsTrue(bolResult);
        }
Exemple #10
0
        public void AddNodeInfoTest()
        {
            string strFilePath   = Environment.CurrentDirectory + "\\LayoutSetting.xml";
            string strParertName = "LayoutSetting";
            string strNodeName   = "SetingInfo";

            string[] strsField = new string[] { "key", "value", "defaultvalue", "describe", "tag", "ramark", "remark1", "remark2", "remark3" };
            string[] strsValue = new string[] { "key", "value", "defaultvalue", "describe", "tag", "ramark", "remark1", "remark2", "remark3" };
            bool     bolResult = XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);

            Assert.IsTrue(bolResult);
        }
Exemple #11
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);
        }
Exemple #12
0
        public void DeleteNodeInfoTest()
        {
            string       strFilePath   = Environment.CurrentDirectory + "\\EntranceTypeInfo.xml";
            string       strParertName = "EntranceTypeInfo";
            string       strNodeName   = "EntranceType";
            EntranceType e             = new EntranceType
            {
                Key  = "11",
                Key2 = "12"
            };
            bool bolResult = XmlUse.DeleteNodeInfo(e, strFilePath, strParertName);

            Assert.IsTrue(bolResult);
        }
Exemple #13
0
        public void AddNodeInfoTest1()
        {
            bool   bolResult     = false;
            string strFilePath   = Environment.CurrentDirectory + "\\EntranceTypeInfo.xml";
            string strParertName = "EntranceTypeInfo";

            XmlUse.CreateXmlFile(strFilePath, strParertName);

            string strNodeName;

            string[] strsField;
            string[] strsValue;

            strNodeName = "EntranceType";
            strsField   = new string[] { "Key", "Key1", "Name", "ProgValue", "Describe" };
            strsValue   = new string[] { "21", "21E0", "联动门外门", "DoubleDoorFinger", "" };
            XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);


            strNodeName = "EntranceType";
            strsField   = new string[] { "Key", "Key1", "Name", "ProgValue", "Describe" };
            strsValue   = new string[] { "25", "21E1", "联动门内门", "DoubleInDoorFinger", "" };
            XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);

            strNodeName = "EntranceType";
            strsField   = new string[] { "Key", "Key1", "Name", "ProgValue", "Describe" };
            strsValue   = new string[] { "22", "22E1", "业务库金库门", "MoneyRoomFinger", "" };
            XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);


            strNodeName = "EntranceType";
            strsField   = new string[] { "Key", "Key1", "Name", "ProgValue", "Describe" };
            strsValue   = new string[] { "24", "22E0", "业务库隔离门", "SplitDoorFinger", "" };
            XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);

            strNodeName = "EntranceType";
            strsField   = new string[] { "Key", "Key1", "Name", "Progvalue", "Describe" };
            strsValue   = new string[] { "23", "23E0", "加钞间", "AddMoneyFinger", "" };
            XmlUse.AddNodeInfo(strFilePath, strParertName, strNodeName, strsField, strsValue);

            Assert.IsTrue(bolResult);
        }