예제 #1
0
        public void XmlSerializationTest()
        {
            var e = new LogEntry
            {
                Date    = DateTime.Now,
                Message = "Message",
                Title   = "Title",
                Object  = CreateException(),
                Source  = LoggerType.Mine
            };

            var xml = TypeSerializer <LogEntry> .ToXmlString(e);

            Assert.IsNotEmpty(xml);
            Console.WriteLine(xml);

            var de = TypeSerializer <LogEntry> .FromXmlString(xml);

            Assert.AreEqual(e.Title, de.Title);
            Assert.AreEqual(e.Date.Date, de.Date.Date);
            Assert.AreEqual(e.Message, de.Message);
            Assert.AreEqual(e.Source, de.Source);
        }