예제 #1
0
        public void DeserializeXml()
        {
            var user = Users[0];

            using (var ms = new MemoryStream()) {
                XmlTool.Serialize(user, ms);

                ms.SetStreamPosition();

                var xml = ms.ToText();
                // string xml = StringTool.ToString(ms);

                ms.SetStreamPosition();
                var user2 = XmlTool.Deserialize <User>(ms);

                Assert.AreEqual(user.Id, user2.Id);
                Assert.AreEqual(user.Name, user2.Name);
                Assert.AreEqual(user.Description, user2.Description);

                Assert.IsTrue(user.Equals(user2));
            }
        }
예제 #2
0
        public void SerializeToXmlDocument()
        {
            XmlDocument doc;

            Assert.IsTrue(XmlTool.Serialize(Users, out doc));
        }