public void ShouldCreateBlogPost() { Mock <IAuthorRepository> authorRepositoryMock = new Mock <IAuthorRepository>(); Mock <IBlogPostRepository> blogPostRepositoryMock = new Mock <IBlogPostRepository>(); authorRepositoryMock.Setup(x => x.GetByUserIdAndId(It.IsAny <string>(), It.IsAny <string>())).Returns(new Author { Name = "AuthorTest", UserId = "12345" }); var authorData = new BlogPostDTO { Title = "Test1", AuthorId = "5b9d8e952e6adf8005dbcf17", Content = "test content" }; var mapper = TestHelper.GetMapper(); var sut = new BlogPostService(authorRepositoryMock.Object, blogPostRepositoryMock.Object, mapper); sut.CreateBlogPost("12345", authorData); }
public void CreateBlogPost(BlogPostModel blogPost) { blogPostService.CreateBlogPost(blogPost); }