public void GetEmployeesProjectsTest() { EmployeeService employeeService = new EmployeeService(uow, new Map <Employee, EmployeeDTO>()); ProjectService projectService = new ProjectService(uow, new Map <Project, ProjectDTO>()); ProjectWorkService projectWorkService = new ProjectWorkService(uow, new Map <ProjectWork, ProjectWorkDTO>()); EmployeeDTO employee1 = new EmployeeDTO { EmployeeName = "Екатерина", EmployeeSurname = "Антонович", EmployeePatronymic = "Алексеевна", RoleId = 3, Email = "*****@*****.**", }; var employeeOnWork1 = employeeService.CreateEmployee(employee1); var em1 = employeeService.GetEmployeeById(employeeOnWork1.Id); ProjectDTO project1 = new ProjectDTO { ProjectName = "проект 1", ProjectDescription = "проект номер один", ProjectStartDate = new DateTimeOffset(2021, 10, 6, 10, 15, 35, new TimeSpan(3, 0, 0)), ProjectEndDate = new DateTimeOffset(2021, 10, 21, 10, 15, 35, new TimeSpan(3, 0, 0)) }; var proj1 = projectService.CreateProject(project1); var pr1 = projectService.GetProjectById(proj1.Id); ProjectDTO project2 = new ProjectDTO { ProjectName = "проект 2", ProjectDescription = "проект номер два", ProjectStartDate = new DateTimeOffset(2021, 2, 14, 10, 15, 35, new TimeSpan(3, 0, 0)), ProjectEndDate = new DateTimeOffset(2021, 8, 21, 10, 15, 35, new TimeSpan(3, 0, 0)) }; var proj2 = projectService.CreateProject(project2); var pr2 = projectService.GetProjectById(proj2.Id); ProjectWorkDTO projectWork1 = new ProjectWorkDTO { EmployeeId = em1.Id, ProjectId = pr1.Id, ProjectRoleId = 3 }; var errors1 = pwvalidator.Validate(projectWork1); var pWork1 = projectWorkService.CreateProjectWork(projectWork1); var actual1 = projectWorkService.GetProjectWorkById(pWork1.Id); ProjectWorkDTO projectWork2 = new ProjectWorkDTO { EmployeeId = em1.Id, ProjectId = pr2.Id, ProjectRoleId = 5 }; var errors2 = pwvalidator.Validate(projectWork2); var pWork2 = projectWorkService.CreateProjectWork(projectWork2); var actual2 = projectWorkService.GetProjectWorkById(pWork2.Id); var result = projectWorkService.GetEmployeesProjects(em1.Id).ToList(); Assert.AreEqual(result.Count, 2); projectWorkService.DeleteProjectWorkById(actual1.Id); projectWorkService.DeleteProjectWorkById(actual2.Id); employeeService.DeleteEmployeeById(em1.Id); projectService.DeleteProjectById(pr1.Id); projectService.DeleteProjectById(pr2.Id); }