public void WorksWithMixtureOfGenericAndConcreteParams() { var methodCall = MethodCallBuilder .Create <Example, IEnumerable <string>, int, string, double>((e, a, b, c) => e.OverloadedGeneric(a, b, c)) .SetArguments(1, "two", 3.2); ExecuteAndAssert(new [] { "1", "two", "3.2" }, methodCall); }
public void WorksWhenNotAllArgsAreUsed() { var methodCall = MethodCallBuilder .Create <Example, string, double, int, string>((e, y, x, z) => e.SingleArg(z)) .SetArguments(3.5, 1, "single"); ExecuteAndAssert("single", methodCall); }
public void WorksWithGenericClass() { var methodCall = MethodCallBuilder .Create <GenericExample <int>, int, int>((ge, i) => ge.Echo(i)) .SetArgument(532); ExecuteAndAssert(532, methodCall); }
public void WorksWhenThereAreGenericOverloads() { var methodCall = MethodCallBuilder .Create <Example, IEnumerable <string>, string, int>((e, x, y) => e.OverloadedGeneric(x, y)) .SetArguments("one", 2); ExecuteAndAssert(new [] { "one", "2" }, methodCall); }
public void WorksWhenThereAreOverloads() { var methodCall = MethodCallBuilder .Create <Example, string, string, string>((e, x, y) => e.SingleArg(x, y)) .SetArguments("first", "second"); ExecuteAndAssert("firstsecond", methodCall); }
public void WorksWithGenericArgs() { var methodCall = MethodCallBuilder .Create <Example, IEnumerable <string>, string, int>((e, a, b) => e.WithGenericArgs(a, b)) .SetArguments("first thing", 21); ExecuteAndAssert(new [] { "first thing", "21" }, methodCall); }
public void WorksWithParametersOutOfOrder() { var methodCall = MethodCallBuilder .Create <Example, IEnumerable <string>, double, int, string>((e, y, x, z) => e.WithThreeArgs(x, y, z)) .SetArguments(3.5, 1, "four"); ExecuteAndAssert(new [] { "1", "3.5", "four" }, methodCall); }
public void WorksWithZeroArguments() { var methodCall = MethodCallBuilder.Create <Example, string>(e => e.NoArguments()); ExecuteAndAssert("no args were passed in", methodCall); }