Ejemplo n.º 1
0
        public void BagSerializeBytes()
        {
            PropertyBag bag = this.CreateBag();

            XmlSerializer serializer = new XmlSerializer(typeof(PropertyBag));
            byte[] xml = null;

            Assert.DoesNotThrow(() => xml = serializer.ToBytes(bag));
            Assert.True(!xml.IsNullOrEmpty());

            PropertyBag bag2 = null;
            Assert.DoesNotThrow(() => bag2 = (PropertyBag)serializer.FromBytes(xml));
            Assert.NotNull(bag2);

            Assert.True(Compare(bag, bag2));
        }