Beispiel #1
0
        public void TestSkipCycle()
        {
            var test = new ComplexTestObject
            {
                Child = new ComplexChildObject()
            };

            test.Child.Parent = test;

            var serialized = serializer.SerializeToString(test);
            var newObj     = serializer.Deserialize <ComplexTestObject>(serialized);

            Assert.AreEqual(newObj, newObj.Child.Parent);
            Assert.AreEqual(newObj.Child, newObj.Child.Parent.Child);
        }
Beispiel #2
0
        public void TestComplexSerializer()
        {
            var test = new ComplexTestObject
            {
                IntegerValue = 4,
                Child        = new ComplexChildObject
                {
                    Text = "Test"
                }
            };

            var serialized = serializer.SerializeToString(test);
            var newObj     = serializer.Deserialize <ComplexTestObject>(serialized);

            Assert.AreEqual(test.IntegerValue, newObj.IntegerValue);
            Assert.AreEqual(test.Child.Text, newObj.Child.Text);
        }