Esempio n. 1
0
        public void FromXml_Object()
        {
            var o = new SimpleClass {ID = 1, Name = "asdf"};
            var xml = CompulsoryCow.Serializer.ToXml(o);

            var res = CompulsoryCow.Deserializer.FromXml<SimpleClass>(xml);

            Assert.AreEqual(1, res.ID);
            Assert.AreEqual("asdf", res.Name);
        }
Esempio n. 2
0
 public void ToXml_Object()
 {
     var o = new SimpleClass {ID = 1, Name = "asdf"};
     var res = CompulsoryCow.Serializer.ToXml(o);
     Assert.IsNotNull(res.DocumentElement);
     Assert.AreEqual( "SimpleClass", res.DocumentElement.Name);
     Assert.AreEqual(2, res.ChildNodes.Count);
     Assert.AreEqual(
         "<?xml version=\"1.0\"?><SimpleClass xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ID>1</ID><Name>asdf</Name></SimpleClass>",
         res.InnerXml);
 }