示例#1
0
        Test31 test2()
        {
            Test31 test2 = default(Test31);
            Foo3   foo   = new Foo3();

            foo.iFoo   = 3;
            test2.foo1 = foo;
            return(test2);
        }
示例#2
0
        Test31 test2()
        {
            Console.WriteLine("From Program0:test2!");
            Test31 test2 = default(Test31);
            Foo3   foo   = new Foo3();

            foo.iFoo   = 3;
            test2.foo1 = foo;
            return(test2);
        }
示例#3
0
        public static int Main1()
        {
            Program0 p = new Program0();

            Test30 t1Res = p.test1();

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

            Test31 t2Res = p.test2();

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

            Test32 t3Res = p.test3();

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

            Test33 t4Res = p.test4();

            Console.WriteLine("test4 Result: {0}", t4Res.foo1.iFoo + t4Res.foo2.iFoo);
            if ((t4Res.foo1.iFoo + t4Res.foo2.iFoo) != 11)
            {
                throw new Exception("Failed test4 test!");
            }

            Test34 test5 = default(Test34);

            test5.i1 = 10;
            test5.i2 = 11;
            test5.f1 = 12;

            Test34 t5Res = p.test5(test5);

            Console.WriteLine("test5 Result: {0}", t5Res.i1 + t5Res.i2 + t5Res.f1);
            if ((t5Res.i1 + t5Res.i2 + t5Res.f1) != 42.0)
            {
                throw new Exception("Failed test5 test!");
            }

            return(100);
        }