Skip to content

Commit

Permalink
Add unit test for Apply
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed Jan 24, 2025
1 parent d1b272e commit af801d8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Funcky.Test/FunctionalClass/ApplyTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using static Funcky.Discard;

namespace Funcky.Test.FunctionalClass;

public class ApplyTest
{
[Fact]
public void CanApplyParametersInAnyOrder()
{
var func = Linear0;
var f1 = Fn(Linear0).Apply(__, __, 10);
var f2 = func.Apply(2, __, 7);
var f3 = Apply(Fn(Linear0), 42, __, __);
Assert.Equal(Linear0(10, 2, 10), f1(10, 2));
Assert.Equal(Linear0(2, 10, 7), f2(10));
Assert.Equal(Linear0(42, 10, 2), f3(10, 2));
}

public static T Fn<T>(T value) => value;

private static int Linear0(int a, int b, int c)
=> a + (b * c);
}

0 comments on commit af801d8

Please sign in to comment.