コード例 #1
0
        public void TestConnectorSerialization()
        {
            var obj = new FourInOneOutExpression();

            var tw = new StringWriter();
            using (var xw = XmlWriter.Create(tw))
            {
                xw.WriteStartElement("Node");
                obj.Serialize(xw);
                xw.WriteEndElement();
            }

            var sr = new StringReader(tw.ToString());
            using (var wr = XmlReader.Create(sr))
            {
                wr.ReadToFollowing("Node");
                var result = new FourInOneOutExpression();
                result.Deserialize(wr);

                Assert.AreEqual(obj.Id, result.Id);
                Assert.AreEqual(obj.Connector1In.Id, result.Connector1In.Id);
                Assert.AreEqual(obj.Connector2In.Id, result.Connector2In.Id);
                Assert.AreEqual(obj.Connector3In.Id, result.Connector3In.Id);
                Assert.AreEqual(obj.Connector4In.Id, result.Connector4In.Id);
                Assert.AreEqual(obj.ConnectorOut.Id, result.ConnectorOut.Id);
            }
        }