Example #1
0
        public void CheckEquals(List val)
        {
            SerializationTest.AssertEquals("List.children.Length", children.Length, val.children.Length);

            for (int n = 0; n < children.Length; n++)
            {
                children[n].CheckEquals(val.children[n]);
            }

            SerializationTest.AssertEquals("List.name", name, val.name);
            values.CheckEquals(val.values);
        }
Example #2
0
        public static void EqualsArray(string message, object oar1, object oar2)
        {
            if (oar1 == null || oar2 == null || !(oar1 is Array) || !(oar2 is Array))
            {
                SerializationTest.AssertEquals(message, oar1, oar2);
                return;
            }

            Array ar1 = (Array)oar1;
            Array ar2 = (Array)oar2;

            SerializationTest.AssertEquals(message + ".Length", ar1.Length, ar2.Length);

            for (int n = 0; n < ar1.Length; n++)
            {
                object av1 = ar1.GetValue(n);
                object av2 = ar2.GetValue(n);
                SerializationTest.AssertEquals(message + "[" + n + "]", av1, av2);
            }
        }
Example #3
0
        public void CheckEquals(SomeValues obj)
        {
            SerializationTest.AssertEquals("SomeValues._type", _type, obj._type);
            SerializationTest.AssertEquals("SomeValues._type2", _type2, obj._type2);
            SerializationTest.AssertEquals("SomeValues._dbnull", _dbnull, obj._dbnull);
            SerializationTest.AssertEquals("SomeValues._assembly", _assembly, obj._assembly);

            SerializationTest.AssertEquals("SomeValues._intEnum", _intEnum, obj._intEnum);
            SerializationTest.AssertEquals("SomeValues._byteEnum", _byteEnum, obj._byteEnum);
            SerializationTest.AssertEquals("SomeValues._bool", _bool, obj._bool);
            SerializationTest.AssertEquals("SomeValues._bool2", _bool2, obj._bool2);
            SerializationTest.AssertEquals("SomeValues._byte", _byte, obj._byte);
            SerializationTest.AssertEquals("SomeValues._char", _char, obj._char);
            SerializationTest.AssertEquals("SomeValues._dateTime", _dateTime, obj._dateTime);
            SerializationTest.AssertEquals("SomeValues._decimal", _decimal, obj._decimal);
            SerializationTest.AssertEquals("SomeValues._int", _int, obj._int);
            SerializationTest.AssertEquals("SomeValues._long", _long, obj._long);
            SerializationTest.AssertEquals("SomeValues._sbyte", _sbyte, obj._sbyte);
            SerializationTest.AssertEquals("SomeValues._float", _float, obj._float);
            SerializationTest.AssertEquals("SomeValues._ushort", _ushort, obj._ushort);
            SerializationTest.AssertEquals("SomeValues._uint", _uint, obj._uint);
            SerializationTest.AssertEquals("SomeValues._ulong", _ulong, obj._ulong);

            SerializationTest.EqualsArray("SomeValues._objects", _objects, obj._objects);
            SerializationTest.EqualsArray("SomeValues._strings", _strings, obj._strings);
            SerializationTest.EqualsArray("SomeValues._doubles", _doubles, obj._doubles);
            SerializationTest.EqualsArray("SomeValues._ints", _ints, obj._ints);
            SerializationTest.EqualsArray("SomeValues._simples", _simples, obj._simples);
            SerializationTest.EqualsArray("SomeValues._almostEmpty", _almostEmpty, obj._almostEmpty);

            SerializationTest.EqualsArray("SomeValues._emptyObjectArray", _emptyObjectArray, obj._emptyObjectArray);
            SerializationTest.EqualsArray("SomeValues._emptyTypeArray", _emptyTypeArray, obj._emptyTypeArray);
            SerializationTest.EqualsArray("SomeValues._emptySimpleArray", _emptySimpleArray, obj._emptySimpleArray);
            SerializationTest.EqualsArray("SomeValues._emptyIntArray", _emptyIntArray, obj._emptyIntArray);
            SerializationTest.EqualsArray("SomeValues._emptyStringArray", _emptyStringArray, obj._emptyStringArray);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 4; k++)
                    {
                        SerializationTest.AssertEquals("SomeValues._intsMulti[" + i + "," + j + "," + k + "]", _intsMulti[i, j, k], obj._intsMulti[i, j, k]);
                    }
                }
            }

            for (int i = 0; i < _intsJagged.Length; i++)
            {
                for (int j = 0; j < _intsJagged[i].Length; j++)
                {
                    SerializationTest.AssertEquals("SomeValues._intsJagged[" + i + "][" + j + "]", _intsJagged[i][j], obj._intsJagged[i][j]);
                }
            }

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    SerializationTest.AssertEquals("SomeValues._simplesMulti[" + i + "," + j + "]", _simplesMulti[i, j], obj._simplesMulti[i, j]);
                }
            }

            for (int i = 0; i < _simplesJagged.Length; i++)
            {
                SerializationTest.EqualsArray("SomeValues._simplesJagged", _simplesJagged[i], obj._simplesJagged[i]);
            }

            int acum = 0;

            SerializationTest.AssertEquals("SomeValues._sampleDelegate", _sampleDelegate("hi", this, ref acum), _int);
            SerializationTest.AssertEquals("SomeValues._sampleDelegate_bis", _sampleDelegate("hi", this, ref acum), obj._sampleDelegate("hi", this, ref acum));

            SerializationTest.AssertEquals("SomeValues._sampleDelegate2", _sampleDelegate2("hi", this, ref acum), (int)_simples[0].val);
            SerializationTest.AssertEquals("SomeValues._sampleDelegate2_bis", _sampleDelegate2("hi", this, ref acum), obj._sampleDelegate2("hi", this, ref acum));

            SerializationTest.AssertEquals("SomeValues._sampleDelegate3", _sampleDelegate3("hi", this, ref acum), (int)'x');
            SerializationTest.AssertEquals("SomeValues._sampleDelegate3_bis", _sampleDelegate3("hi", this, ref acum), obj._sampleDelegate3("hi", this, ref acum));

            SerializationTest.AssertEquals("SomeValues._sampleDelegateStatic", _sampleDelegateStatic("hi", this, ref acum), 99);
            SerializationTest.AssertEquals("SomeValues._sampleDelegateStatic_bis", _sampleDelegateStatic("hi", this, ref acum), obj._sampleDelegateStatic("hi", this, ref acum));

            int acum1 = 0;
            int acum2 = 0;

            _sampleDelegateCombined("hi", this, ref acum1);
            obj._sampleDelegateCombined("hi", this, ref acum2);

            SerializationTest.AssertEquals("_sampleDelegateCombined", acum1, _int + (int)_simples[0].val + (int)'x' + 99);
            SerializationTest.AssertEquals("_sampleDelegateCombined_bis", acum1, acum2);

            SerializationTest.AssertEquals("SomeValues._shared1", _shared1, _shared2);
            SerializationTest.AssertEquals("SomeValues._shared1_bis", _shared1, _shared3);

            _shared1.val = 'B';
            SerializationTest.AssertEquals("SomeValues._shared2", _shared2.val, 'A');
            SerializationTest.AssertEquals("SomeValues._shared3", _shared3.val, 'B');
        }
Example #4
0
 public void CheckEquals(Point p)
 {
     SerializationTest.AssertEquals("Point.x", x, p.x);
     SerializationTest.AssertEquals("Point.y", y, p.y);
 }
Example #5
0
        public static void Main()
        {
            SerializationTest test = new SerializationTest();

            test.TestSerialization();
        }
Example #6
0
 public void CheckEquals(ListValue val)
 {
     SerializationTest.AssertEquals("ListValue.color", color, val.color);
     point.CheckEquals(val.point);
 }
Example #7
0
 public void CheckEquals(ListItem val)
 {
     SerializationTest.AssertEquals("ListItem.next", next, val.next);
     SerializationTest.AssertEquals("ListItem.label", label, val.label);
     value.CheckEquals(val.value);
 }
Example #8
0
		public static void Main() 
		{
			SerializationTest test = new SerializationTest();
			test.TestSerialization();
		}