public async Task GetByIdTest() { _repoWrapper.Setup(r => r.Education.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <Education, bool> > >(), null)).ReturnsAsync(new Education()); var service = new EducationService(_repoWrapper.Object, _mapper.Object); _mapper.Setup(x => x.Map <Education, EducationDTO>(It.IsAny <Education>())).Returns(new EducationDTO()); // Act var result = await service.GetByIdAsync(1); // Assert Assert.NotNull(result); Assert.IsType <EducationDTO>(result); }