コード例 #1
0
        public void CheckEquals(SomeValues obj, string context)
        {
            Assert.AreEqual(_type, obj._type, context + "._type");
            Assert.AreEqual(_type2, obj._type2, context + "._type2");
            Assert.AreEqual(_dbnull, obj._dbnull, context + "._dbnull");
            Assert.AreEqual(_assembly, obj._assembly, context + "._assembly");

            Assert.AreEqual(_intEnum, obj._intEnum, context + "._intEnum");
            Assert.AreEqual(_byteEnum, obj._byteEnum, context + "._byteEnum");
            Assert.AreEqual(_bool, obj._bool, context + "._bool");
            Assert.AreEqual(_bool2, obj._bool2, context + "._bool2");
            Assert.AreEqual(_byte, obj._byte, context + "._byte");
            Assert.AreEqual(_char, obj._char, context + "._char");
            Assert.AreEqual(_dateTime, obj._dateTime, context + "._dateTime");
            Assert.AreEqual(_decimal, obj._decimal, context + "._decimal");
            Assert.AreEqual(_double, obj._double, context + "._double");
            Assert.AreEqual(_short, obj._short, context = "._short");
            Assert.AreEqual(_int, obj._int, context + "._int");
            Assert.AreEqual(_long, obj._long, context + "._long");
            Assert.AreEqual(_sbyte, obj._sbyte, context + "._sbyte");
            Assert.AreEqual(_float, obj._float, context + "._float");
            Assert.AreEqual(_ushort, obj._ushort, context + "._ushort");
            Assert.AreEqual(_uint, obj._uint, context + "._uint");
            Assert.AreEqual(_ulong, obj._ulong, context + "._ulong");

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

            SerializationTest.EqualsArray(context + "._emptyObjectArray", _emptyObjectArray, obj._emptyObjectArray);
            SerializationTest.EqualsArray(context + "._emptyTypeArray", _emptyTypeArray, obj._emptyTypeArray);
            SerializationTest.EqualsArray(context + "._emptySimpleArray", _emptySimpleArray, obj._emptySimpleArray);
            SerializationTest.EqualsArray(context + "._emptyIntArray", _emptyIntArray, obj._emptyIntArray);
            SerializationTest.EqualsArray(context + "._emptyStringArray", _emptyStringArray, obj._emptyStringArray);
            SerializationTest.EqualsArray(context + "._emptyPointArray", _emptyPointArray, obj._emptyPointArray);

            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');

            SerializationTest.AssertEquals("SomeValues._falseSerializable", _falseSerializable.field, 2);
        }
コード例 #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
ファイル: SerializationTest.cs プロジェクト: nlhepler/mono
		public void CheckEquals (SomeValues obj, string context)
		{
			Assert.AreEqual (_type, obj._type, context + "._type");
			Assert.AreEqual (_type2, obj._type2, context + "._type2");
			Assert.AreEqual (_dbnull, obj._dbnull, context + "._dbnull");
			Assert.AreEqual (_assembly, obj._assembly, context + "._assembly");

			Assert.AreEqual (_intEnum, obj._intEnum, context + "._intEnum");
			Assert.AreEqual (_byteEnum, obj._byteEnum, context + "._byteEnum");
			Assert.AreEqual (_bool, obj._bool, context + "._bool");
			Assert.AreEqual (_bool2, obj._bool2, context + "._bool2");
			Assert.AreEqual (_byte, obj._byte, context + "._byte");
			Assert.AreEqual (_char, obj._char, context + "._char");
			Assert.AreEqual (_dateTime, obj._dateTime, context + "._dateTime");
			Assert.AreEqual (_decimal, obj._decimal, context + "._decimal");
			Assert.AreEqual (_double, obj._double, context + "._double");
			Assert.AreEqual (_short, obj._short, context = "._short");
			Assert.AreEqual (_int, obj._int, context + "._int");
			Assert.AreEqual (_long, obj._long, context + "._long");
			Assert.AreEqual (_sbyte, obj._sbyte, context + "._sbyte");
			Assert.AreEqual (_float, obj._float, context + "._float");
			Assert.AreEqual (_ushort, obj._ushort, context + "._ushort");
			Assert.AreEqual (_uint, obj._uint, context + "._uint");
			Assert.AreEqual (_ulong, obj._ulong, context + "._ulong");

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

			SerializationTest.EqualsArray (context + "._emptyObjectArray", _emptyObjectArray, obj._emptyObjectArray);
			SerializationTest.EqualsArray (context + "._emptyTypeArray", _emptyTypeArray, obj._emptyTypeArray);
			SerializationTest.EqualsArray (context + "._emptySimpleArray", _emptySimpleArray, obj._emptySimpleArray);
			SerializationTest.EqualsArray (context + "._emptyIntArray", _emptyIntArray, obj._emptyIntArray);
			SerializationTest.EqualsArray (context + "._emptyStringArray", _emptyStringArray, obj._emptyStringArray);
			SerializationTest.EqualsArray (context + "._emptyPointArray", _emptyPointArray, obj._emptyPointArray);

			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');
			
			SerializationTest.AssertEquals ("SomeValues._falseSerializable", _falseSerializable.field, 2);
		}
コード例 #6
0
ファイル: SerializationTest.cs プロジェクト: nlhepler/mono
		public static int SampleStaticCall (string str, SomeValues sv, ref int acum)
		{
			acum += 99;
			return 99;
		}
コード例 #7
0
ファイル: SerializationTest.cs プロジェクト: nlhepler/mono
		public int SampleCall (string str, SomeValues sv, ref int acum)
		{
			acum += _int;
			return _int;
		}
コード例 #8
0
ファイル: SerializationTest.cs プロジェクト: nlhepler/mono
		public int SampleCall (string str, SomeValues sv, ref int acum)
		{
			acum += (int)val;
			return (int)val;
		}