public void GetByIdTasks() { var quantity = 1; var tasks = TaskBuilder.GetTasks(quantity); var moq = new AutoMoqer(); moq.GetMock <ITaskRepository>() .Setup(x => x.ListAll()) .Returns(tasks.AsQueryable()); var svc = moq.Create <TaskRepository>(); var activeTask = svc.GetById(1); Assert.IsTrue(activeTask != null); }