public void Curry_ParameterizedDelegateFourLeadingParams_Curries() { // ----------------------- Arrange ----------------------- ParamFunc <int, int, int, int, int, int> add = (x, y, z, a, args) => x *y *z *a *args.Sum(); // ----------------------- Act ----------------------- ParamFunc <int, int, int, int, int> addDouble = add.Curry(2); //----------- Assert------------------------------- Assert.True(addDouble(1, 1, 1, 1, 1, 1) == 6); }
public void Curry_ParameterizedDelegate_Curries() { // ----------------------- Arrange ----------------------- ParamFunc <int, int> add = args => args.Sum(); // ----------------------- Act ----------------------- ParamFunc <int, int> add3 = add.Curry(3); // ----------------------- Assert ----------------------- Assert.True(add3(1) == 4); Assert.True(add3(1, 2, 3, 6, 9) == 24); Assert.True(add3() == 3); Assert.True(add3(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == 3); }