Esempio n. 1
0
 public void BagSerializeText()
 {
     PropertyBag bag = this.CreateBag();
     
     XmlSerializer serializer = new XmlSerializer(typeof(PropertyBag));
     string xml = null;
     
     Assert.DoesNotThrow(() => xml = serializer.ToXml(bag));            
     Assert.True(!string.IsNullOrEmpty(xml));
     
     PropertyBag bag2 = null;
     Assert.DoesNotThrow(() => bag2 = (PropertyBag) serializer.FromXml(xml));
     Assert.NotNull(bag2);
     
     Assert.True(Compare(bag, bag2));
 }
Esempio n. 2
0
        public void SetSerializeText()
        {
            PropertySet set = this.CreateSet();

            XmlSerializer serializer = new XmlSerializer(typeof(PropertySet));
            string xml = null;

            Assert.DoesNotThrow(() => xml = serializer.ToXml(set));
            Assert.True(!string.IsNullOrEmpty(xml));

            PropertySet set2 = null;
            Assert.DoesNotThrow(() => set2 = (PropertySet) serializer.FromXml(xml));
            Assert.NotNull(set2);

            Assert.True(Compare(set, set2));
        }