Пример #1
0
        public static int Main1()
        {
            Test20 t1 = default(Test20);

            t1.i1 = 1;
            t1.i2 = 2;
            t1.i3 = 3;
            t1.i4 = 4;
            t1.i5 = 5;
            t1.i6 = 6;
            t1.i7 = 7;
            t1.i8 = 8;

            Test21 t2 = default(Test21);

            t2.i1 = 9;
            t2.d1 = 10;

            Test22 t3 = default(Test22);

            t3.o1 = new object();
            t3.o2 = new object();
            t3.o3 = new object();
            t3.o4 = new object();

            Test23 t4 = default(Test23);

            t4.i1  = 1;
            t4.i2  = 2;
            t4.i3  = 3;
            t4.i4  = 4;
            t4.i5  = 5;
            t4.i6  = 6;
            t4.i7  = 7;
            t4.i8  = 8;
            t4.i9  = 9;
            t4.i10 = 10;
            t4.i11 = 11;
            t4.i12 = 12;
            t4.i13 = 13;
            t4.i14 = 14;
            t4.i15 = 15;
            t4.i16 = 16;
            t4.i17 = 17;
            t4.i18 = 18;
            t4.i19 = 19;
            t4.i20 = 20;
            t4.i21 = 21;
            t4.i22 = 22;
            t4.i23 = 23;
            t4.i24 = 24;

            Foo1 foo = new Foo1();

            foo.iFoo = 8;

            int t1Res = test20(t1);

            Console.WriteLine("test1 Result: {0}", t1Res);
            if (t1Res != 36)
            {
                throw new Exception("Failed test1 test!");
            }

            int t2Res = test21(t2);

            Console.WriteLine("test2 Result: {0}", t2Res);
            if (t2Res != 19)
            {
                throw new Exception("Failed test2 test!");
            }

            int t3Res = test22(t3);

            Console.WriteLine("test3 Result: {0}", t3Res);
            if (t3Res == 0) // Adding HashCodes should be != 0.
            {
                throw new Exception("Failed test3 test!");
            }

            int t4Res = test23(t4);

            Console.WriteLine("test4 Result: {0}", t4Res);
            if (t4Res != 300)
            {
                throw new Exception("Failed test4 test!");
            }

            int t5Res = test24(1, 2, 3, 4, 5, 6, 7, foo);

            if (t5Res != 36)
            {
                throw new Exception("Failed test5 test!");
            }
            return(100);
        }
Пример #2
0
 static int test21(Test21 t2)
 {
     Console.WriteLine("test2Res: {0}", t2.i1 + t2.d1);
     return (int)(t2.i1 + t2.d1);
 }
Пример #3
0
 static int test21(Test21 t2)
 {
     Console.WriteLine("test2Res: {0}", t2.i1 + t2.d1);
     return((int)(t2.i1 + t2.d1));
 }