public void Can_Not_Add_Null_Post() { var repository = new Mock<IPostRepository>(); var component = new PostComponent(repository.Object); Post post = null; component.Add(post); }
public void Can_Not_Add_Post_Without_Body() { // Arrange ... var repository = new Mock<IPostRepository>(); var component = new PostComponent(repository.Object); Post post = new Post(); post.Title = "This is a very simple title for my first post"; post.Blog = new Blog(); post.Author = new User(); // Act ... component.Add(post); // Assert .. verify repository.Verify(c => c.Add(post), Times.Never()); }