Ejemplo n.º 1
0
 public ClassA(int pX, int pY, ClassB pClassB)
 {
     x = pX;
     y = pY;
     classB = pClassB;
     classA = this;
 }
Ejemplo n.º 2
0
        public void ClassBXml()
        {
            SimplTypesScope.EnableGraphSerialization();

            ClassB test = new ClassB(1, 2);
            ClassA classA = new ClassA(3, 4, test);

            test.ClassA = classA;

            SimplTypesScope tScope = SimplTypesScope.Get("classB", typeof(ClassA), typeof(ClassB));

            TestMethods.TestSimplObject(test, tScope, Format.Xml);

            SimplTypesScope.DisableGraphSerialization();
        }
Ejemplo n.º 3
0
        //        [TestMethod]
        public void ClassBJson()
        {
            SimplTypesScope.EnableGraphSerialization();

            ClassA test = new ClassA(1, 2);
            ClassB classB = new ClassB(3, 4, test);

            test.ClassB = classB;

            SimplTypesScope tScope = SimplTypesScope.Get("classA", typeof(ClassA), typeof(ClassB));

            TestMethods.TestSimplObject(test, tScope, Format.Json);

            SimplTypesScope.DisableGraphSerialization();
        }
Ejemplo n.º 4
0
        public void DifferentSimplClassesAreConsideredDifferent()
        {
            ClassA test = new ClassA(1, 2);
            ClassB classB = new ClassB(3, 3, test);
            test.ClassB = classB;

            ClassA anotherA = new ClassA(1, 2);
            ClassB anotherB = new ClassB(3, 4, anotherA);
            anotherA.ClassB = anotherB;

            Assert.IsFalse(anotherA == test, "Should be different objects, Class A");
            Assert.IsFalse(anotherB == classB, "Should be different objects, Class B");

            Assert.IsTrue(TestMethods.CompareOriginalObjectToDeserializedObject(classB, anotherB).Any(), "ClassB's in both cases should not be the same");
            Assert.IsTrue(TestMethods.CompareOriginalObjectToDeserializedObject(test, anotherA).Any(), "ClassA's should not both be the same");
        }