public void Setup() { _post = PostFactories.Post(); _post.Delete(); _post.Restore(); _event = _post.Events.OfType <PostRestored>().Single(); }
public void Setup() { _post = PostFactories.Post(); _post.Publish(); _post.Withdraw(); _event = _post.Events.OfType <PostWithdrew>().Single(); }
public async Task Setup() { _post = PostFactories.Post(); _post.Publish(); _command = new WithdrawPost { BlogId = Guid.NewGuid(), AggregateRootId = Guid.NewGuid() }; _postRepositoryMock = new Mock <IPostRepository>(); _postRepositoryMock .Setup(x => x.GetByIdAsync(_command.BlogId, _command.AggregateRootId)) .ReturnsAsync(_post); _postRepositoryMock .Setup(x => x.UpdateAsync(It.IsAny <Post>())) .Callback <Post>(p => _updatedPost = p) .Returns(Task.CompletedTask); _commandHandler = new WithdrawPostHandler(_postRepositoryMock.Object); _result = await _commandHandler.HandleAsync(_command); _event = _updatedPost.Events.OfType <PostWithdrew>().Single(); }
public void Setup() { _post = PostFactories.Post(); _command = PostFactories.UpdatePostCommand(); _validatorMock = new Mock <IValidator <UpdatePost> >(); _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _post.Update(_command, _validatorMock.Object); _event = _post.Events.OfType <PostUpdated>().Single(); }
public async Task Setup() { _post = PostFactories.Post(); _command = PostFactories.UpdatePostCommand(); _validatorMock = new Mock <IValidator <UpdatePost> >(); _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _postRepositoryMock = new Mock <IPostRepository>(); _postRepositoryMock .Setup(x => x.GetByIdAsync(_command.BlogId, _command.AggregateRootId)) .ReturnsAsync(_post); _postRepositoryMock .Setup(x => x.UpdateAsync(It.IsAny <Post>())) .Callback <Post>(p => _updatedPost = p) .Returns(Task.CompletedTask); _commandHandler = new UpdatePostHandler(_postRepositoryMock.Object, _validatorMock.Object); _result = await _commandHandler.HandleAsync(_command); _event = _updatedPost.Events.OfType <PostUpdated>().Single(); }
public void Setup() { _post = PostFactories.Post(); _post.Publish(); _event = _post.Events.OfType <PostPublished>().Single(); }