Esempio n. 1
0
        public void CanDelete_should_throw_exception_if_comment_not_found()
        {
            var commentId = DomainId.NewGuid();
            var command   = new DeleteComment {
                CommentId = commentId, Actor = user1
            };

            var events = new List <Envelope <CommentsEvent> >();

            Assert.Throws <DomainObjectNotFoundException>(() => GuardComments.CanDelete(command, commentsId, events));
        }
Esempio n. 2
0
        public void CanDelete_should_not_throw_exception_if_comment_from_same_user()
        {
            var commentId = DomainId.NewGuid();
            var command   = new DeleteComment {
                CommentId = commentId, Actor = user1
            };

            var events = new List <Envelope <CommentsEvent> >
            {
                Envelope.Create <CommentsEvent>(new CommentCreated {
                    CommentId = commentId, Actor = user1
                }).To <CommentsEvent>()
            };

            GuardComments.CanDelete(command, commentsId, events);
        }
Esempio n. 3
0
        public void CanDelete_should_throw_exception_if_comment_from_another_user()
        {
            var commentId = DomainId.NewGuid();
            var command   = new DeleteComment {
                CommentId = commentId, Actor = user2
            };

            var events = new List <Envelope <CommentsEvent> >
            {
                Envelope.Create <CommentsEvent>(new CommentCreated {
                    CommentId = commentId, Actor = user1
                }).To <CommentsEvent>()
            };

            Assert.Throws <DomainException>(() => GuardComments.CanDelete(command, commentsId, events));
        }