BlogSharp.Core.Impl.Tests.Services.Post.PostServiceTests.Repository_is_not_called_if_event_is_cancelled C# (CSharp) Method

Repository_is_not_called_if_event_is_cancelled() private method

private Repository_is_not_called_if_event_is_cancelled ( ) : void
return void
        public void Repository_is_not_called_if_event_is_cancelled()
        {
            var post = MockRepository.GenerateStub<Model.Post>();
            var postComment = MockRepository.GenerateStub<Feedback>();

            postService.CommentAdded += delegate { throw new AssertionException("Shouldn't be called"); };
            postService.CommentAdding += x => x.Cancel = true;
            postService.PostAdding += x => x.Cancel = true;
            postService.PostAdded += delegate { throw new AssertionException("Shouldn't be called"); };
            postService.PostRemoved += delegate { throw new AssertionException("Shouldn't be called"); };
            postService.PostRemoving += x => x.Cancel = true;
            postService.AddComment(postComment);
            postRepository.AssertWasNotCalled(x => x.SaveComment(postComment));
            postService.AddPost(post);
            postRepository.AssertWasNotCalled(x => x.SavePost(post));
            postService.RemovePost(post);
            postRepository.AssertWasNotCalled(x => x.DeletePost(post));
        }