public IfPassedANewPostWithATitle() { _newPost = AddPostHandlerTests.CreateValidPostForAdding(); _newPost.Title = Title; AddPostHandler handler = AddPostHandlerTests.CreateHandler(); _response = handler.Handle(new AddPostRequest(_newPost)); }
public IfPassedAValidNewPost() { _mockPersistance = new Mock <IRepository>(); _mockPersistance .Setup(m => m.StorePost(It.IsAny <Post>())) .Returns <Post>(p => { var storedPost = Post.Clone(p); storedPost.Id = NewId; _storedPost = storedPost; return(_storedPost.Id); }); _mockPersistance .Setup(m => m.GetPost(NewId)) .Returns(() => _storedPost); AddPostHandler handler = AddPostHandlerTests.CreateHandler(_mockPersistance.Object); Post newPost = AddPostHandlerTests.CreateValidPostForAdding(); _response = handler.Handle(new AddPostRequest(newPost)); }
public IfPassedAnEmptyRequest() { _handler = AddPostHandlerTests.CreateHandler(); }
public IfPassedANewPostWithAnId() { _handler = AddPostHandlerTests.CreateHandler(); _newPost = AddPostHandlerTests.CreateValidPostForAdding(); _newPost.Id = "ShouldNotHaveOne"; }
public IfPassedANewPostWithANullTitle() { _handler = AddPostHandlerTests.CreateHandler(); _newPost = AddPostHandlerTests.CreateValidPostForAdding(); _newPost.Title = null; }
public void ThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => AddPostHandlerTests.CreateHandler(null)); }