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); }
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); }