public void CommentRepository_DeleteById_ThrowsExceptionWhenIdNotFound()
        {
            //arrange
            ICommentRepo cr = GetInMemoryCommentRepository();

            //assert
            Assert.ThrowsAny <ArgumentNullException>(() => cr.DeleteById(0));
        }
Ejemplo n.º 2
0
 public IActionResult DeleteComment([FromBody] User user, int commentId)
 {
     if (user.AdminUser)
     {
         _commentRepository.DeleteById(commentId);
         return(Ok());
     }
     else
     {
         return(Unauthorized());
     }
 }