public void Initialize() { _mockemployeeTaskRepository = new Mock <IEmployeeTaskRepository>(); _service = new EmployeeTaskServices(_mockemployeeTaskRepository.Object); _list = new List <EmployeeTask> { new EmployeeTask { Id = 1, TaskName = "A", StartDate = DateTime.Parse("1989-2-12"), Deadline = DateTime.Parse("1989-2-13") }, new EmployeeTask { Id = 2, TaskName = "B", StartDate = DateTime.Parse("1989-2-12"), Deadline = DateTime.Parse("1989-2-16") }, new EmployeeTask { Id = 3, TaskName = "C", StartDate = DateTime.Parse("1989-2-12"), Deadline = DateTime.Parse("1989-2-20") }, }; _mockemployeeTaskRepository.Setup(d => d.GetEmployeeTaskById(It.IsAny <int>())).ReturnsAsync((int s) => _list.First(x => x.Id == s)); }
public EmployeeTasksController(IEmployeeTaskServices employeeTaskServices) { _employeeTaskService = employeeTaskServices; }