Esempio n. 1
0
        public void Init()
        {
            _type     = typeof(string);
            _type2    = typeof(SomeValues);
            _dbnull   = DBNull.Value;
            _assembly = typeof(SomeValues).Assembly;
            _intEnum  = IntEnum.bbb;
            _byteEnum = ByteEnum.ccc;
            _bool     = true;
            _bool2    = false;
            _byte     = 254;
            _char     = 'A';
            _dateTime = new DateTime(1972, 7, 13, 1, 20, 59);
            _decimal  = (decimal)101010.10101;
            _double   = 123456.6789;
            _short    = -19191;
            _int      = -28282828;
            _long     = 37373737373;
            _sbyte    = -123;
            _float    = (float)654321.321;
            _ushort   = 61616;
            _uint     = 464646464;
            _ulong    = 55555555;

            Point p = new Point();

            p.x = 56; p.y = 67;
            object boxedPoint = p;

            long   i         = 22;
            object boxedLong = i;

            _objects   = new object[] { "string", (int)1234, null, /*boxedPoint, boxedPoint,*/ boxedLong, boxedLong };
            _strings   = new string[] { "an", "array", "of", "strings", "I", "repeat", "an", "array", "of", "strings" };
            _ints      = new int[] { 4, 5, 6, 7, 8 };
            _intsMulti = new int[2, 3, 4] {
                { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } }, { { 13, 14, 15, 16 }, { 17, 18, 19, 20 }, { 21, 22, 23, 24 } }
            };
            _intsJagged = new int[2][] { new int[3] {
                                             1, 2, 3
                                         }, new int[2] {
                                             4, 5
                                         } };
            _simples      = new SimpleClass[] { new SimpleClass('a'), new SimpleClass('b'), new SimpleClass('c') };
            _simplesMulti = new SimpleClass[2, 3] {
                { new SimpleClass('d'), new SimpleClass('e'), new SimpleClass('f') }, { new SimpleClass('g'), new SimpleClass('j'), new SimpleClass('h') }
            };
            _simplesJagged = new SimpleClass[2][] { new SimpleClass[1] {
                                                        new SimpleClass('i')
                                                    }, new SimpleClass[2] {
                                                        null, new SimpleClass('k')
                                                    } };
            _almostEmpty       = new object[2000];
            _almostEmpty[1000] = 4;

            _emptyObjectArray = new object[0];
            _emptyTypeArray   = new Type[0];
            _emptySimpleArray = new SimpleClass[0];
            _emptyIntArray    = new int[0];
            _emptyStringArray = new string[0];

            // FIXME: Once double.ToString("G17") is implemented
            // we'll be able to serialize double.MaxValue and double.MinValue.
            // Currently, it throws a System.OverflowException.
            //_doubles = new double[] { 1010101.101010, 292929.29292, 3838383.38383, 4747474.474, 56565.5656565, 0, Double.NaN, Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity };
            _doubles = new double[] { 1010101.101010, 292929.29292, 3838383.38383, 4747474.474, 56565.5656565, 0, Double.NaN, Double.NegativeInfinity, Double.PositiveInfinity };

            _sampleDelegate         = new SampleDelegate(SampleCall);
            _sampleDelegate2        = new SampleDelegate(_simples[0].SampleCall);
            _sampleDelegate3        = new SampleDelegate(new SimpleClass('x').SampleCall);
            _sampleDelegateStatic   = new SampleDelegate(SampleStaticCall);
            _sampleDelegateCombined = (SampleDelegate)Delegate.Combine(new Delegate[] { _sampleDelegate, _sampleDelegate2, _sampleDelegate3, _sampleDelegateStatic });

            // This is to test that references are correctly solved
            _shared1 = new SimpleClass('A');
            _shared2 = new SimpleClass('A');
            _shared3 = _shared1;
        }
Esempio n. 2
0
        object[][] ProcessMessages(Stream stream, IMessage[] messages)
        {
            object[][] results = new object[9][];

            AuxProxy     prx = new AuxProxy(stream, "myuri");
            MethodTester mt  = (MethodTester)prx.GetTransparentProxy();
            object       res;

            if (messages != null)
            {
                prx.SetTestMessage(messages[0]);
            }
            res        = mt.OverloadedMethod();
            results[0] = new object[] { res };

            if (messages != null)
            {
                prx.SetTestMessage(messages[1]);
            }
            res        = mt.OverloadedMethod(22);
            results[1] = new object[] { res };

            if (messages != null)
            {
                prx.SetTestMessage(messages[2]);
            }
            int[] par1 = new int[] { 1, 2, 3 };
            res        = mt.OverloadedMethod(par1);
            results[2] = new object[] { res, par1 };

            if (messages != null)
            {
                prx.SetTestMessage(messages[3]);
            }
            mt.NoReturn();

            if (messages != null)
            {
                prx.SetTestMessage(messages[4]);
            }
            res        = mt.Simple("hello", 44);
            results[4] = new object[] { res };

            if (messages != null)
            {
                prx.SetTestMessage(messages[5]);
            }
            res        = mt.Simple2('F');
            results[5] = new object[] { res };

            if (messages != null)
            {
                prx.SetTestMessage(messages[6]);
            }
            char[] par2 = new char[] { 'G' };
            res        = mt.Simple3(par2);
            results[6] = new object[] { res, par2 };

            if (messages != null)
            {
                prx.SetTestMessage(messages[7]);
            }
            res        = mt.Simple3(null);
            results[7] = new object[] { res };

            if (messages != null)
            {
                prx.SetTestMessage(messages[8]);
            }

            SimpleClass b = new SimpleClass('H');

            res        = mt.SomeMethod(123456, b);
            results[8] = new object[] { res, b };

            return(results);
        }
Esempio n. 3
0
		public void Init()
		{
			_type = typeof (string);
			_type2 = typeof (SomeValues);
			_dbnull = DBNull.Value;
			_assembly = typeof (SomeValues).Assembly;
			_intEnum = IntEnum.bbb;
			_byteEnum = ByteEnum.ccc;
			_bool = true;
			_bool2 = false;
			_byte = 254;
			_char = 'A';
//			_dateTime = new DateTime (1972,7,13,1,20,59);
			_decimal = (decimal)101010.10101;
			_double = 123456.6789;
			_short = -19191;
			_int = -28282828;
			_long = 37373737373;
			_sbyte = -123;
			_float = (float)654321.321;
			_ushort = 61616;
			_uint = 464646464;
			_ulong = 55555555;

			Point p = new Point();
			p.x = 56; p.y = 67;
			object boxedPoint = p;

			long i = 22;
			object boxedLong = i;

			_objects = new object[] { "string", (int)1234, null , /*boxedPoint, boxedPoint,*/ boxedLong, boxedLong};
			_strings = new string[] { "an", "array", "of", "strings","I","repeat","an", "array", "of", "strings" };
			_ints = new int[] { 4,5,6,7,8 };
			_intsMulti = new int[2,3,4] { { {1,2,3,4},{5,6,7,8},{9,10,11,12}}, { {13,14,15,16},{17,18,19,20},{21,22,23,24} } };
			_intsJagged = new int[2][] { new int[3] {1,2,3}, new int[2] {4,5} };
			_simples = new SimpleClass[] { new SimpleClass('a'),new SimpleClass('b'),new SimpleClass('c') };
			_simplesMulti = new SimpleClass[2,3] {{new SimpleClass('d'),new SimpleClass('e'),new SimpleClass('f')}, {new SimpleClass('g'),new SimpleClass('j'),new SimpleClass('h')}};
			_simplesJagged = new SimpleClass[2][] { new SimpleClass[1] { new SimpleClass('i') }, new SimpleClass[2] {null, new SimpleClass('k')}};
			_almostEmpty = new object[2000];
			_almostEmpty[1000] = 4;

			_emptyObjectArray = new object[0];
			_emptyTypeArray = new Type[0];
			_emptySimpleArray = new SimpleClass[0];
			_emptyIntArray = new int[0];
			_emptyStringArray = new string[0];

			// FIXME: Once double.ToString("G17") is implemented
			// we'll be able to serialize double.MaxValue and double.MinValue.
			// Currently, it throws a System.OverflowException.
			//_doubles = new double[] { 1010101.101010, 292929.29292, 3838383.38383, 4747474.474, 56565.5656565, 0, Double.NaN, Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity };
			_doubles = new double[] { 1010101.101010, 292929.29292, 3838383.38383, 4747474.474, 56565.5656565, 0, Double.NaN, Double.NegativeInfinity, Double.PositiveInfinity };

			_sampleDelegate = new SampleDelegate(SampleCall);
			_sampleDelegate2 = new SampleDelegate(_simples[0].SampleCall);
			_sampleDelegate3 = new SampleDelegate(new SimpleClass('x').SampleCall);
			_sampleDelegateStatic = new SampleDelegate(SampleStaticCall);
			_sampleDelegateCombined = (SampleDelegate)Delegate.Combine (new Delegate[] {_sampleDelegate, _sampleDelegate2, _sampleDelegate3, _sampleDelegateStatic });

			// This is to test that references are correctly solved
			_shared1 = new SimpleClass('A');
			_shared2 = new SimpleClass('A');
			_shared3 = _shared1;
		}
Esempio n. 4
0
		public int SomeMethod (int a, SimpleClass b)
		{
			object[] d;
			string c = "hi";
			int r = a + c.Length;
			c = "bye";
			d = new object[3];
			d[1] = b;
			return r;
		}
Esempio n. 5
0
		object[][] ProcessMessages (Stream stream, IMessage[] messages)
		{
			object[][] results = new object[9][];

			AuxProxy prx = new AuxProxy (stream, "myuri");
			MethodTester mt = (MethodTester)prx.GetTransparentProxy();
			object res;

			if (messages != null) prx.SetTestMessage (messages[0]);
			res = mt.OverloadedMethod();
			results[0] = new object[] {res};

			if (messages != null) prx.SetTestMessage (messages[1]);
			res = mt.OverloadedMethod(22);
			results[1] = new object[] {res};

			if (messages != null) prx.SetTestMessage (messages[2]);
			int[] par1 = new int[] {1,2,3};
			res = mt.OverloadedMethod(par1);
			results[2] = new object[] { res, par1 };

			if (messages != null) prx.SetTestMessage (messages[3]);
			mt.NoReturn();

			if (messages != null) prx.SetTestMessage (messages[4]);
			res = mt.Simple ("hello",44);
			results[4] = new object[] { res };

			if (messages != null) prx.SetTestMessage (messages[5]);
			res = mt.Simple2 ('F');
			results[5] = new object[] { res };

			if (messages != null) prx.SetTestMessage (messages[6]);
			char[] par2 = new char[] { 'G' };
			res = mt.Simple3 (par2);
			results[6] = new object[] { res, par2 };

			if (messages != null) prx.SetTestMessage (messages[7]);
			res = mt.Simple3 (null);
			results[7] = new object[] { res };

			if (messages != null) prx.SetTestMessage (messages[8]);

			SimpleClass b = new SimpleClass ('H');
			res = mt.SomeMethod (123456, b);
			results[8] = new object[] { res, b };

			return results;
		}