예제 #1
0
        public void TestSerializeIncomplete()
        {
            var x = new CIncompleteImplicitSurrogate();
            var s = new CSurrogate(typeof(CIncompleteImplicitSurrogate));

            var doc = new XmlDocument();

            doc.LoadXml("<_/>");

            var isComplete = s.Serialize(x, doc.DocumentElement, null);

            Assert.AreEqual(false, isComplete, "Expected an incomplete serialization");
            Assert.AreEqual(ETestStatus.IMPLICIT_SERIALIZER_INCOMPLETE,
                            CStdImplicitSurrogate.STATUS,
                            "The status was not correctly set.");
        }
예제 #2
0
        public void TestDeserializeIncomplete()
        {
            CIncompleteImplicitSurrogate x = null;
            var s = new CSurrogate(typeof(CIncompleteImplicitSurrogate));

            var doc = new XmlDocument();

            doc.LoadXml("<_ NAME=\"Mike\" AGE='69' Incomplete='Yes' />");

            CStdBaseObject.STATUS = ETestStatus.NONE;
            var o          = new CWorkingObject();
            var isComplete = s.Deserialize(o, doc.DocumentElement, null);

            x = (CIncompleteImplicitSurrogate)o.WorkingObject;

            Assert.AreEqual(false, isComplete, "Expected the deserializer to be incomplete.");
            Assert.AreEqual(ETestStatus.IMPLICIT_DESERIALIZER_INCOMPLETE,
                            CStdImplicitSurrogate.STATUS,
                            "The status was not correctly set.");
        }