Пример #1
0
        public void DeleteComment_DeletesCommentFromRepo()
        {
            //Arrange
            Comment comment = new Comment();
            Post    post    = new Post();

            mapper.Map <CommentPatchDto, Comment>(testCommentPatchDto, comment);
            postRepositoryMock.Setup(x => x.GetById(comment.PostId)).Returns(post);
            commentRepositoryMock.Setup(x => x.GetById(Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6"))).Returns(comment);

            //Act
            systemUnderTest.Delete(Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6"));

            //Assert
            commentRepositoryMock.Verify(m => m.Delete(Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6")), Times.Once);
        }