public Container(ClassWithInterfaces classWithInterfaces, ClassWithPrimitiveTypes classWithPrimitiveTypes, ClassAbstract classAbstract ) { ClassWithInterfaces = classWithInterfaces; ClassWithPrimitiveTypes = classWithPrimitiveTypes; ClassAbstract = classAbstract; }
public void TestSerialization() { StringBuilder builder = new StringBuilder(); Util.TestSerializer(builder, new ClassWithPrimitiveTypes()); Util.TestSerializer(builder, new ClassWithArrays()); Util.TestSerializer(builder, new SuperClassWithPrimitivesAndArrays()); Util.TestSerializer(builder, new StructWithPrimitiveTypes()); Util.TestSerializer(builder, new ClassWithWeirdTypes()); ClassWithPrimitiveTypes c = new ClassWithPrimitiveTypes(); c.myObject = new Object(); c.dayOfWeek = DayOfWeek.Friday; c.myString = "hello[]{}\"\" \\"; Util.TestSerializer(builder, c); ClassWithArrays ca = new ClassWithArrays(); ca.ushortArray = new UInt16[] { 0, 99, ushort.MinValue, 7483, ushort.MaxValue, 7575 }; ca.shortArray = new Int16[] { short.MinValue, short.MaxValue, 4848 }; ca.uintArray = new UInt32[] { uint.MinValue, uint.MaxValue, 9493, 382983, 444, 3443, 14427 }; ca.intArray = new Int32[] { int.MinValue, int.MaxValue, -9494593, 384562983, 4244, 344523, 144227 }; ca.ulongArray = new UInt64[] { ulong.MinValue, ulong.MaxValue }; ca.longArray = new Int64[] { long.MinValue, long.MaxValue }; ca.enumArray = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Saturday, DayOfWeek.Wednesday, DayOfWeek.Friday }; ca.objectArray = new Object[] { new Object(), null, new Object() }; ca.stringArray = new String[] { null, String.Empty, "hello", "[]", "{,,,}" }; Console.WriteLine(ca.SerializeObject()); Util.TestSerializer(builder, ca); SuperClassWithPrimitivesAndArrays sca = new SuperClassWithPrimitivesAndArrays(); sca.c = c; sca.ca = ca; SuperClassWithPrimitivesAndArrays scaMess1 = new SuperClassWithPrimitivesAndArrays(); SuperClassWithPrimitivesAndArrays scaMess2 = new SuperClassWithPrimitivesAndArrays(); scaMess1.c = c; scaMess2.c = c; scaMess1.ca = ca; scaMess2.ca = ca; sca.mess = new SuperClassWithPrimitivesAndArrays[] { scaMess1, scaMess2 }; Util.TestSerializer(builder, sca); }