public void GetArtifactById_Return404NotFound_WhenIDDoesNotExist() { mockRepo.Setup(repo => repo.GetArtifactById(0)).Returns(() => null); var controller = new ArtifactController(mockRepo.Object, mapper); var result = controller.GetArtifactById(1); Assert.IsType <NotFoundResult>(result.Result); }
public void GetArtifactById_ReturnsCorrectType_WhenIDExists() { mockRepo.Setup(repo => repo.GetArtifactById(1)).Returns(new Artifact { Id = 1, PhotoUrl = "www.heartofthecards.com/millenium-puzzle", Title = "Yugi solves the Millenium Puzzle" }); var controller = new ArtifactController(mockRepo.Object, mapper); var result = controller.GetArtifactById(1); Assert.IsType <ActionResult <ArtifactReadDto> >(result); }