public EstimateTaskController( IEstimateTaskService estimateTaskService, IMapper mapper) { _service = estimateTaskService; _mapper = mapper; }
public EstimateTaskServiceTest() { // Arrange foreach (var et in TestData.estimateTask) { _estimateTask.Add(new EstimateTask { Mark = et.Mark, TaskText = et.TaskText, AdditionalText = et.AdditionalText, ApprovalEmployee = et.ApprovalEmployee, }); } foreach (var mark in TestData.marks) { _mockMarkRepo.Setup(mock => mock.GetById(mark.Id)).Returns( TestData.marks.SingleOrDefault(v => v.Id == mark.Id)); _repository.Setup(mock => mock.GetByMarkId(mark.Id)).Returns( _estimateTask.SingleOrDefault(v => v.Mark.Id == mark.Id)); } foreach (var employee in TestData.employees) { _mockEmployeeRepo.Setup(mock => mock.GetById(employee.Id)).Returns( TestData.employees.SingleOrDefault(v => v.Id == employee.Id)); } _repository.Setup(mock => mock.Add(It.IsAny <EstimateTask>())).Verifiable(); _repository.Setup(mock => mock.Update(It.IsAny <EstimateTask>())).Verifiable(); _service = new EstimateTaskService( _repository.Object, _mockMarkRepo.Object, _mockEmployeeRepo.Object); }