コード例 #1
0
        public void Should_Not_Delete_Post_If_It_Not_Found()
        {
            // Arrange
            var post = new Domain.Post
            {
                Content  = "Content",
                Title    = "Title",
                Comments = new[]
                {
                    new Domain.Comment {
                        CommentText = "CommentText"
                    }
                }
            };

            _posts.Add(post);

            // Act & Assert
            Assert.ThrowsAsync <EntityNotFoundException>(
                () => _postProvider.DeletePost(100500));
            Assert.IsNotEmpty(_posts);
        }
コード例 #2
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);
        }