Я использую Moq и пытаюсь настроить макет GetPagedList
для IRepository<TEntity>
. Ниже приведен интерфейс, который я пытаюсь смоделировать
IPagedList GetPagedList (Expression> expateate = null,Func, IOrderedQueryable> orderBy = null, Func, IIncludableQueryable> include = null, int pageIndex = 0, int pageSize = 20, bool = true);
Мой сервис
public class StudentService
{
private readonly IRepository<Student> _repo;
public StudentService( IUnitOfWork unitOfWork )
{
_repo = unitOfWork.GetRepository<Student>();
_unitOfWork = unitOfWork;
}
public IPagedList<Student> Get(int id)
{
return _repo.GetPagedList(predicate: a => a.id == id);
}
}
Мой модульТест
[Fact]
public void StudentService_GetStudentClasses_ReturnListOfClasses()
{
int studentId = 100;
_mockStudentRepo.Setup(x => x.GetPagedList(It.IsAny <
Expression<Func<Student, bool>>,
Func<IQueryable<Student>, IOrderedQueryable<Student>>,
Func<IQueryable<Student>, IIncludableQueryable<Student, object>>,
int, int, bool > ())).Returns(MockStudentList.Where(a => a.id == studentId ()).ToPagedList(0, 20));
}
Получение этой ошибки
Использование универсального метода It.IsAny<TValue>()
требует аргументов 1 типа.
Буду очень признателен за любые идеи, как это исправить.