I have the following method within a repository that I am trying to Mock:
IEnumerable GetAll(
Expression> fi
Your GetAll
method takes three arguments and returns an IEnumerable
. The valueFunction
parameter in Returns
needs to have a matching signature and return type. The valueFunction
parameter in your example only has two input arguments and the second argument does not match any of the argument types passed to GetAll
. It should look something like this (I don't have the benefit of the compiler checking my syntax but I think what I have here should be correct):
mockContactNumberRepository
.Setup(x =>
x
.GetAll(
It.IsAny>>(),
It.IsAny, IOrderedQueryable>>(),
It.IsAny()))
.Returns(new Func<
Expression>,
Func, IOrderedQueryable>,
string,
IEnumerable>((arg1, arg2, arg3) =>
{
// arg1 is Expression>
// arg2 is Func, IOrderedQueryable>
// arg3 is string
// Do something here and return an IEnumerable
}));