I am trying to use Moq to mock a reponse from a method which uses the params keyword with an int array
public interface IValidationHelper
{
Task<bool> ValidateParents(params int?[] parents);
}
I am findning myself having to mock it in two ways to get it to properly mock. First, with a single param, and second, with two params. Is there a way to specify something like params in a It.IsAny in the Setup?
private void MockValidateParents(bool valid = true)
{
_validationHelper.Setup(x => x.ValidateParents(
It.IsAny<int>()
)).ReturnsAsync(valid);
_validationHelper.Setup(x => x.ValidateParents(
It.IsAny<int>(),
It.IsAny<int>()
)).ReturnsAsync(valid);
}