public async System.Threading.Tasks.Task GetProjectsWherePersonIsAttendant_ThereIsNoProjectsForTheGivenAttendant_ShouldReturnNull() { mockPersonInProjectRepository.Setup(x => x.GetProjectsByPersonWithProjectData(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.GetProjectsWherePersonIsAttendant(It.IsAny <Guid>()); Assert.IsTrue(!result.Any()); }
public async System.Threading.Tasks.Task GetProjectsWherePersonIsAttendant_ThereIsProjectsForTheGivenAttendant_ShouldReturnProjects() { mockPersonInProjectRepository.Setup(x => x.GetProjectsByPersonWithProjectData(It.IsAny <Guid>())) .Returns(System.Threading.Tasks.Task.FromResult(GetPersonInProjects().Where(x => x.PersonId == mockPersonId))); var personInProjectService = new PersonInProjectService(mapper, mockPersonInProjectRepository.Object, mockPersonRepository.Object, mockProjectRepository.Object); var result = await personInProjectService.GetProjectsWherePersonIsAttendant(mockPersonId); Assert.IsTrue(result.Any()); Assert.AreEqual(GetPersonInProjects().Count(x => x.PersonId == mockPersonId), result.Count()); }