Beispiel #1
0
        public void Ph_Tests_EmptyConstructor()
        {
            /* Initialization. */
            Ph phElement = new Ph();

            /* Set of Assertions. */
            Assert.AreEqual(null, phElement.GetXmlNode);
            Assert.AreEqual(-1, phElement.PhId);
            Assert.AreEqual(String.Empty, phElement.PhContent);
        }
Beispiel #2
0
        public void Ph_Test_Null()
        {
            /* Initialization. */
            XmlNode xmlPhNode = null;
            Ph      phElement = new Ph(xmlPhNode);

            /* Set of Assertions. */
            Assert.AreEqual(null, phElement.GetXmlNode);
            Assert.AreEqual(-1, phElement.PhId);
            Assert.AreEqual(String.Empty, phElement.PhContent);
        }
 //列表会用于修改页面,必须防止其他线程更改该列表的值
 public IList <BaseDevice> GetDevices()
 {
     return(new List <BaseDevice>()
     {
         In.CloneProperties(),
         Out.CloneProperties(),
         Temperature.CloneProperties(),
         Rocker.CloneProperties(),
         Gas.CloneProperties(),
         Ph.CloneProperties(),
         Do.CloneProperties()
     });
 }
Beispiel #4
0
        public void DataTest_Ph_Tests_Methods_GetXmlAttributeValue(string inputFile, int phPosition, string expectedAttributeName, string expectedValue)
        {
            /* Initialization. */
            XmlDocument xlfDocument = new XmlDocument();

            xlfDocument.Load(inputFile);

            XmlNode xmlPhNode = xlfDocument.SelectNodes("//ph").Item(phPosition);
            Ph      phElement = new Ph(xmlPhNode);

            /* Set of Assertions. */
            Assert.AreEqual(expectedValue, phElement.GetXmlAttributeValue(expectedAttributeName));
        }
Beispiel #5
0
        public void DataTest_Ph_Tests_Properties(string inputFile, int phPosition, int expectedIndex, string expectedContent)
        {
            /* Initialization. */
            XmlDocument xlfDocument = new XmlDocument();

            xlfDocument.Load(inputFile);

            XmlNode xmlPhNode = xlfDocument.SelectNodes("//ph").Item(phPosition);
            Ph      phElement = new Ph(xmlPhNode);

            /* Set of Assertions. */
            Assert.AreEqual(xmlPhNode, phElement.xmlPhNode);
            Assert.AreEqual(expectedIndex, phElement.PhId);
            Assert.AreEqual(expectedContent, phElement.PhContent);
        }
Beispiel #6
0
        public void Ph_Tests_EmptyFile()
        {
            /* Initialization. */
            XmlDocument xlfDocument = new XmlDocument();

            xlfDocument.Load(empty);

            XmlNode xmlPhNode = xlfDocument.SelectNodes("//ph").Item(0);
            Ph      phElement = new Ph(xmlPhNode);

            /* Set of Assertions. */
            Assert.AreEqual(null, phElement.GetXmlNode);
            Assert.AreEqual(-1, phElement.PhId);
            Assert.AreEqual(String.Empty, phElement.PhContent);
        }
Beispiel #7
0
        public void DataTest_Ph_Tests_Methods_GetEquivTextAttribute(string inputFile, int phPosition, string expectedValue)
        {
            /* Initialization. */
            XmlDocument xlfDocument = new XmlDocument();

            xlfDocument.Load(inputFile);

            XmlNode xmlPhNode = xlfDocument.SelectNodes("//ph").Item(phPosition);
            Ph      phElement = new Ph(xmlPhNode);

            XmlAttribute auxiliaryAttribute = xmlPhNode.Attributes["equiv-text"];

            /* Set of Assertions. */
            Assert.IsNotNull(auxiliaryAttribute);
            Assert.AreEqual(expectedValue, auxiliaryAttribute.Value);
            Assert.AreEqual(auxiliaryAttribute, phElement.GetEquivTextAttribute());
        }
Beispiel #8
0
        public Source(XmlNode xmlSourceNode)
        {
            this.xmlSourceNode = xmlSourceNode;

            if (xmlSourceNode != null)
            {
                xmlSourceAttributeCollection = xmlSourceNode.Attributes;

                XmlNodeList bptNodeList = xmlSourceNode.SelectNodes("./bpt");
                Bpt         auxiliaryBpt;

                if (bptNodeList != null)
                {
                    foreach (XmlNode bptNode in bptNodeList)
                    {
                        auxiliaryBpt = new Bpt(bptNode);
                        bptList.Add(auxiliaryBpt);
                    }
                }


                XmlNodeList eptNodeList = xmlSourceNode.SelectNodes("./ept");
                Ept         auxiliaryEpt;

                if (eptNodeList != null)
                {
                    foreach (XmlNode eptNode in eptNodeList)
                    {
                        auxiliaryEpt = new Ept(eptNode);
                        eptList.Add(auxiliaryEpt);
                    }
                }


                XmlNodeList itNodeList = xmlSourceNode.SelectNodes("./it");
                It          auxiliaryIt;

                if (itNodeList != null)
                {
                    foreach (XmlNode itNode in itNodeList)
                    {
                        auxiliaryIt = new It(itNode);
                        itList.Add(auxiliaryIt);
                    }
                }


                XmlNodeList phNodeList = xmlSourceNode.SelectNodes("./ph");
                Ph          auxiliaryPh;

                if (phNodeList != null)
                {
                    foreach (XmlNode phNode in phNodeList)
                    {
                        auxiliaryPh = new Ph(phNode);
                        phList.Add(auxiliaryPh);
                    }
                }

                sourceContent = xmlSourceNode.InnerXml;
            }
            else
            {
                xmlSourceNode = null;

                sourceContent = "";
            }
        }
Beispiel #9
0
        public Target(XmlNode xmlTargetNode)
        {
            this.xmlTargetNode = xmlTargetNode;

            if (xmlTargetNode != null)
            {
                XmlNodeList bptNodeList = xmlTargetNode.OwnerDocument.SelectNodes("\\bpt");
                Bpt         auxiliaryBpt;

                if (bptNodeList != null)
                {
                    foreach (XmlNode bptNode in bptNodeList)
                    {
                        auxiliaryBpt = new Bpt(bptNode);
                        bptList.Add(auxiliaryBpt);
                    }
                }


                XmlNodeList eptNodeList = xmlTargetNode.OwnerDocument.SelectNodes("\\ept");
                Ept         auxiliaryEpt;

                if (eptNodeList != null)
                {
                    foreach (XmlNode eptNode in eptNodeList)
                    {
                        auxiliaryEpt = new Ept(eptNode);
                        eptList.Add(auxiliaryEpt);
                    }
                }


                XmlNodeList itNodeList = xmlTargetNode.OwnerDocument.SelectNodes("\\it");
                It          auxiliaryIt;

                if (itNodeList != null)
                {
                    foreach (XmlNode itNode in itNodeList)
                    {
                        auxiliaryIt = new It(itNode);
                        itList.Add(auxiliaryIt);
                    }
                }


                XmlNodeList phNodeList = xmlTargetNode.OwnerDocument.SelectNodes("\\ph");
                Ph          auxiliaryPh;

                if (phNodeList != null)
                {
                    foreach (XmlNode phNode in phNodeList)
                    {
                        auxiliaryPh = new Ph(phNode);
                        phList.Add(auxiliaryPh);
                    }
                }
            }
            else
            {
            }
        }