public async Task GetPhotoByIdShouldReturnOkIfFoundInDatabase() { // Arrange var photoId = 1; mockRepo.Setup(x => x.Photo).Returns(_photoRepoMock.Object); _photoRepoMock.Setup(x => x.GetPhotoById(photoId)).ReturnsAsync(new Photo()); // Act var result = await _sut.GetPhotoById(photoId); // Assert Assert.IsType <OkObjectResult>(result); Assert.IsNotType <NotFoundResult>(result); }
PhotoModel InterfacePhotoController.GetPhotoByID(int id) { using (var service = new PhotoController()) { return(service.GetPhotoById(id).GetModel()); } }