示例#1
0
        public void SerializationOfAdditionalInfoTest()
        {
            var field = new DestinationField(new Connection(), true);
            field.AdditionalInfo = new CrossReferenceFieldInfo("Process");

            //Serialize properties
            var tw = new StringWriter();

            using (var xw = XmlWriter.Create(tw))
            {
                xw.WriteStartElement("DestinationField");
                field.Serialize(xw);
                xw.WriteEndElement();
            }

            //Deserialize field and restore properties' values            
            var sr = new StringReader(tw.ToString());

            using (var wr = XmlReader.Create(sr))
            {
                wr.ReadToFollowing("DestinationField");
                var restoredField = new DestinationField(new Connection());
                restoredField.Deserialize(wr);

                Assert.IsNotNull(restoredField.AdditionalInfo);
                Assert.AreEqual(
                    ((CrossReferenceFieldInfo)field.AdditionalInfo).ReferencedProcessName,
                    ((CrossReferenceFieldInfo)restoredField.AdditionalInfo).ReferencedProcessName);
            }
        }
示例#2
0
        public void SerializationOfGroupingRelatedPropertiesTest()
        {
            var field = new DestinationField(new Connection(), true);

            //Serialize properties
            var tw = new StringWriter();

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

            //Deserialize field and restore properties' values            
            var sr = new StringReader(tw.ToString());

            using (var wr = XmlReader.Create(sr))
            {
                wr.ReadToFollowing("Node");
                var restoredField = new DestinationField(new Connection());
                restoredField.Deserialize(wr);

                Assert.AreEqual(field.IsGroupingField, restoredField.IsGroupingField);
                Assert.AreEqual(field.IsGroupCollapsed, restoredField.IsGroupCollapsed);
                Assert.AreEqual(field.KeepSubfieldsAlive, restoredField.KeepSubfieldsAlive);
                Assert.AreEqual(field.HideConnector, restoredField.HideConnector);
            }
        }