I have the following method in the repository that I am trying to execute Mock:
IEnumerable<TEntity> GetAll(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "")
I installed the following:
mockContactNumberRepository.Setup(x => x.GetAll(
It.IsAny<Expression<Func<ContactNumber, bool>>>(),
It.IsAny<Func<IQueryable<ContactNumber>, IOrderedQueryable<ContactNumber>>>(),
It.IsAny<string>()))
.Returns(new Func<Expression<Func<ContactNumber, bool>>,
IQueryable<ContactNumber>>(ex => _contactNumbers.Where(ex.Compile()).AsQueryable()));
When starting unit test, an error message appears displaying a mismatch between the parameter counter. I understand this because Returns
only the first parameter indicates, but I'm not sure how to specify additional parameters.
I found many questions that ask similar questions, but did not find one with several lambda expressions.
Any help you can give would be greatly appreciated.
source
share