public async System.Threading.Tasks.Task GetProjectAttendants_ThereIsntAttendantsInTheProject_ShouldReturnEmptyList() { mockPersonInProjectRepository.Setup(x => x.GetProjectAttendants(It.IsAny <Guid>())) .Returns( System.Threading.Tasks.Task.FromResult <IEnumerable <PersonInProject> >(null) ); var personInProjectService = new PersonInProjectService(mapper, mockPersonInProjectRepository.Object, mockPersonRepository.Object, mockProjectRepository.Object); var result = await personInProjectService.GetProjectAttendants(mockProjedtId); Assert.IsTrue(!result.Any()); }
public async System.Threading.Tasks.Task GetProjectAttendants_ThereIsAttendantsInTheProject_ShouldReturnTheProjectAttendants() { mockPersonInProjectRepository.Setup(x => x.GetProjectAttendants(It.IsAny <Guid>())) .Returns( System.Threading.Tasks.Task.FromResult(GetPersonInProjects().Where(x => x.ProjectId == mockProjedtId)) ); var personInProjectService = new PersonInProjectService(mapper, mockPersonInProjectRepository.Object, mockPersonRepository.Object, mockProjectRepository.Object); var result = await personInProjectService.GetProjectAttendants(mockProjedtId); Assert.IsTrue(result.Any()); Assert.AreEqual(GetPersonInProjects().Count(x => x.ProjectId == mockProjedtId), result.Count()); }