I've been using the ReturnsAsync function from Moq with success for a bit, but have bumped into an issue with the following. I always just return null while I'm adding the parameters to my lambda expression...this time when I got them all added, I get the dreaded "Cannot convert lambda expression to type..." Is there anything obvious that I got wrong? The Setup method resolves perfectly fine...just not ReturnsAsync
Is there a limit to how many parameters that can be defined? I've tried and noticed that it craps out after the 15th parameter...
var buildServiceMock = new Mock<IBuildService>();
buildServiceMock
.Setup(bsm => bsm.QueryBuildsAsync(
It.IsAny<BuildType>(),
It.IsAny<string>(),
It.IsAny<DateTime?>(),
It.IsAny<DateTime?>(),
It.IsAny<string>(),
It.IsAny<BuildReason?>(),
It.IsAny<BuildStatus?>(),
It.IsAny<BuildResult?>(),
It.IsAny<IEnumerable<string>>(),
It.IsAny<IEnumerable<string>>(),
It.IsAny<int?>(),
It.IsAny<int?>(),
It.IsAny<QueryDeletedOption?>(),
It.IsAny<BuildQueryOrder?>(),
It.IsAny<string>(),
It.IsAny<IEnumerable<int>>(),
It.IsAny<string>(),
It.IsAny<CancellationToken>()))
.ReturnsAsync((
BuildType buildType,
string buildNumber,
DateTime? minDateTime,
DateTime? maxDateTime,
string requestedFor,
BuildReason? reasonFilter,
BuildStatus? statusFilter,
BuildResult? resultFilter,
IEnumerable<string> tags,
IEnumerable<string> properties,
int? top,
int? maxBuildsPerDefinition,
QueryDeletedOption? deletedFilter,
BuildQueryOrder? queryOrder,
string branchName,
IEnumerable<int> buildIds,
string label,
CancellationToken cancellationToken) =>
{
return null;
});