Пример #1
0
        public void Should_have_error_when_comment_is_null_or_empty()
        {
            var model = new BlogPostModel();

            model.AddNewComment.CommentText = null;
            _validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
            model.AddNewComment.CommentText = "";
            _validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
        }
Пример #2
0
        public void ShouldHaveErrorWhenCommentIsNullOrEmpty()
        {
            var model = new BlogPostModel {
                AddNewComment = { CommentText = null }
            };

            _validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
            model.AddNewComment.CommentText = string.Empty;
            _validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
        }