public void GetIsFavorite_GetIsFavoriteIfPublicationContainAuthor_OkObjectResult() { // Arrange var getableFavorite = new Mock <IGetableFavorite>(); var mapper = new Mock <IMapper>(); var favoriteController = new FavoriteController( getableFavorite.Object, mapper.Object); // Act var result = favoriteController.GetIsFavorite(_favoriteDTO); // Assert Assert.NotNull(result); Assert.IsType <OkObjectResult>(result.Result); }
public void GetIsFavorite_GetIsFavoriteIfPublicationNotFound_NotFound404() { // Arrange var getableFavorite = new Mock <IGetableFavorite>(); var mapper = new Mock <IMapper>(); var favoriteController = new FavoriteController( getableFavorite.Object, mapper.Object); getableFavorite.Setup(gf => gf.GetIsFavorite(_favoriteDTO)) .Throws(new ObjectNotFoundException("Publication not found.")); // Act var result = favoriteController.GetIsFavorite(_favoriteDTO); // Assert Assert.NotNull(result); Assert.IsType <NotFoundObjectResult>(result.Result); }