Beispiel #1
0
        public void LikeOrUnlike_LikeOrUnlikeIfPublicationAndAuthoFound_OkObjectResult()
        {
            // Arrange
            var likeableFavorite = new Mock <ILikeableFavorite>();

            var favoriteController = new FavoriteController(
                likeableFavorite.Object);

            // Act
            var result = favoriteController.LikeOrUnlike(_favoriteDTO);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <OkObjectResult>(result.Result);
        }
        public void LikeOrUnlike_LikeOrUnlikeIfFavoriteDTONotFound_NotFound404()
        {
            // Arrange
            var likeableFavorite = new Mock <ILikeableFavorite>();

            var favoriteController = new FavoriteController(
                likeableFavorite.Object);

            likeableFavorite.Setup(lf => lf.LikeOrUnlike(_invalidFavoriteDTO)).Throws(new ObjectNotFoundException("Objects not found"));

            // Act
            var result = favoriteController.LikeOrUnlike(_invalidFavoriteDTO);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <NotFoundObjectResult>(result.Result);
        }