Пример #1
0
        public void Curry_Action_2()
        {
            // arrange
            var actual = -1;
            Action <int, int> action = (arg1, arg2) =>
            {
                actual = TestFunctions.Add2(arg1, arg2);
            };

            // act
            var curried = action.Curry();

            curried(1)(2);

            // assert
            Assert.Equal(3, actual);
        }
Пример #2
0
        public void Curry_Action_4()
        {
            // arrange
            var actual = -1;
            Action <int, int, int, int> action = (arg1, arg2, arg3, arg4) =>
            {
                actual = TestFunctions.Add4(arg1, arg2, arg3, arg4);
            };

            // act
            var curried = action.Curry();

            curried(1)(2)(3)(4);

            // assert
            Assert.Equal(10, actual);
        }
Пример #3
0
        public void Curry_Action_1()
        {
            // arrange
            var          actual = -1;
            Action <int> action = (arg1) =>
            {
                actual = TestFunctions.Add1(arg1);
            };

            // act
            var curried = action.Curry();

            curried(1);

            // assert
            Assert.Equal(1, actual);
        }
Пример #4
0
        public void Curry_Action_16()
        {
            // arrange
            var actual = -1;
            Action <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int> action = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) =>
            {
                actual = TestFunctions.Add16(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16);
            };

            // act
            var curried = action.Curry();

            curried(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16);

            // assert
            Assert.Equal(136, actual);
        }
Пример #5
0
        public void Curry_Action_10()
        {
            // arrange
            var actual = -1;
            Action <int, int, int, int, int, int, int, int, int, int> action = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) =>
            {
                actual = TestFunctions.Add10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
            };

            // act
            var curried = action.Curry();

            curried(1)(2)(3)(4)(5)(6)(7)(8)(9)(10);

            // assert
            Assert.Equal(55, actual);
        }
Пример #6
0
        public void Curry_Action_0()
        {
            // arrange
            var    actual = -1;
            Action action = () =>
            {
                actual = TestFunctions.Zero();
            };

            // act
            var curried = action.Curry();

            curried();

            // assert
            Assert.Equal(0, actual);
        }
Пример #7
0
        public void Curry_Action_7()
        {
            // arrange
            var actual = -1;
            Action <int, int, int, int, int, int, int> action = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
            {
                actual = TestFunctions.Add7(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
            };

            // act
            var curried = action.Curry();

            curried(1)(2)(3)(4)(5)(6)(7);

            // assert
            Assert.Equal(28, actual);
        }