Example #1
0
 public void WhenTheUserIsAuthenticated_AndAPostsIsCreatedWithoutATitle_ThenAnExceptionIsThrown()
 {
     _service.Setup(s => s.CreatePost(It.IsAny<Post>())).Returns(new Post());
     var hub = new TestableBlogHub(_service.Object, "Kevin");
     Action act = () => hub.Create(new BlogPostViewModel { Body = "entry" });
     act.ShouldThrow<ItsaException>();
 }
Example #2
0
 public void WhenTheUserIsAuthenticated_AndAPostsIsCreated_ThenTheNewPostIsReturned()
 {
     _service.Setup(s => s.CreatePost(It.IsAny<Post>())).Returns(new Post());
     var hub = new TestableBlogHub(_service.Object, "Kevin");
     hub.Create(new BlogPostViewModel { Title = "title", Body = "body" });
     _service.Verify(s => s.CreatePost(It.IsAny<Post>()), Times.Once());
 }