示例#1
0
 public Post DeletePost(Post post)
 {
     if (_postValidator.PostExists(_postRepo.GetAllPosts(), post))
     {
         var isSuccessful = _postRepo.TryDeletePost(post.PostID, out var result);
         return((isSuccessful) ? result : throw new ArgumentException("Something went horribly wrong in PostDataAccess.DeletePost."));
     }
     throw new ArgumentException("The post does not exist.");
 }
示例#2
0
        public void PostExists_True_Success()
        {
            var postInList  = new Post("title", new Author("author", 0), "body");
            var listOfPosts = new List <Post>()
            {
                postInList
            };

            Assert.True(_postValidator.PostExists(listOfPosts, postInList));
        }