예제 #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);
        }
예제 #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);
        }