public ClassA(int pX, int pY, ClassB pClassB) { x = pX; y = pY; classB = pClassB; classA = this; }
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(); }
// [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(); }
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"); }