示例#1
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');
        }
示例#2
0
 public int SampleCall(string str, SomeValues sv, ref int acum)
 {
     acum += _int;
     return(_int);
 }
示例#3
0
 public static int SampleStaticCall(string str, SomeValues sv, ref int acum)
 {
     acum += 99;
     return(99);
 }
示例#4
0
 public int SampleCall(string str, SomeValues sv, ref int acum)
 {
     acum += (int)val;
     return((int)val);
 }
示例#5
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');
		}
示例#6
0
		public static int SampleStaticCall (string str, SomeValues sv, ref int acum)
		{
			acum += 99;
			return 99;
		}
示例#7
0
		public int SampleCall (string str, SomeValues sv, ref int acum)
		{
			acum += _int;
			return _int;
		}
示例#8
0
		public int SampleCall (string str, SomeValues sv, ref int acum)
		{
			acum += (int)val;
			return (int)val;
		}