Ejemplo n.º 1
0
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(8);

            Func <int> func1 = () => Script.Caller <Bridge623A>().foo;

            var point1 = new Bridge623A(1, func1);
            var point2 = new Bridge623A(2, func1);

            assert.Equal(point1.Call(), 1, "Bridge623A point1 func1");
            assert.Equal(point2.Call(), 2, "Bridge623A point2 func1");

            var point3 = new Bridge623B1(3, func1);
            var point4 = new Bridge623B1(4, func1);

            assert.Equal(point3.Call(), 3, "Bridge623B1 point3 func1");
            assert.Equal(point4.Call(), 4, "Bridge623B1 point4 func1");

            Func <int> func2 = () => Script.Caller <Bridge623B1>().GetFoo();

            var point5 = new Bridge623B1(5, func2);
            var point6 = new Bridge623B1(6, func2);

            assert.Equal(point5.Call(), 10, "Bridge623B1 point5 func2");
            assert.Equal(point6.Call(), 12, "Bridge623B1 point6 func2");

            Func <int> func3 = () => Script.Caller <Bridge623B2>().GetFoo();

            var point7 = new Bridge623B2(7, func3);
            var point8 = new Bridge623B2(8, func3);

            assert.Equal(point7.Call(), 1021, "Bridge623B2 point7 func3");
            assert.Equal(point8.Call(), 1024, "Bridge623B2 point8 func3");
        }
Ejemplo n.º 2
0
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(8);

            Func<int> func1 = () => Script.Caller<Bridge623A>().foo;

            var point1 = new Bridge623A(1, func1);
            var point2 = new Bridge623A(2, func1);

            assert.Equal(point1.Call(), 1, "Bridge623A point1 func1");
            assert.Equal(point2.Call(), 2, "Bridge623A point2 func1");

            var point3 = new Bridge623B1(3, func1);
            var point4 = new Bridge623B1(4, func1);

            assert.Equal(point3.Call(), 3, "Bridge623B1 point3 func1");
            assert.Equal(point4.Call(), 4, "Bridge623B1 point4 func1");

            Func<int> func2 = () => Script.Caller<Bridge623B1>().GetFoo();

            var point5 = new Bridge623B1(5, func2);
            var point6 = new Bridge623B1(6, func2);

            assert.Equal(point5.Call(), 10, "Bridge623B1 point5 func2");
            assert.Equal(point6.Call(), 12, "Bridge623B1 point6 func2");

            Func<int> func3 = () => Script.Caller<Bridge623B2>().GetFoo();

            var point7 = new Bridge623B2(7, func3);
            var point8 = new Bridge623B2(8, func3);

            assert.Equal(point7.Call(), 1021, "Bridge623B2 point7 func3");
            assert.Equal(point8.Call(), 1024, "Bridge623B2 point8 func3");
        }