Esempio n. 1
0
        public async Task Should_Delete_Post()
        {
            // Arrange
            var post = new Domain.Post
            {
                Content  = "Content",
                Title    = "Title",
                Comments = new []
                {
                    new Domain.Comment {
                        CommentText = "CommentText"
                    }
                }
            };

            _posts.Add(post);

            // Act
            await _postProvider.DeletePost(post.PostId);

            // Assert
            Assert.IsEmpty(_posts);
        }
Esempio n. 2
0
 public ActionResult DeletePost(int postId)
 {
     try
     {
         _postProvider.DeletePost(postId);
         return(Redirect("~/Post/PostsList"));
     }
     catch (SqlException ex)
     {
         _logger.LogError(ex.Message);
         ViewBag.Message = ex.Message;
         return(View("SqlError"));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(Redirect("/Error/ServerError"));
     }
 }
Esempio n. 3
0
 public async Task DeletePost(int postId)
 {
     await _postProvider.DeletePost(postId);
 }
Esempio n. 4
0
 public bool DeletePost(Post post)
 {
     return(_postProvider.DeletePost(post));
 }