public void ValidComment() { var comment = new Comment() { Txt = "asdassadda", UserID = "correct_user_id", MemeRefId = 1 }; ValidationResult result = commentValidator.Validate(comment); Assert.True(result.IsValid); }
public void Check_CommentTitle_Valid(int textLength) { string text = GetStringWithDesiredLength(textLength); var validator = new CommentValidator(); string[] errors; Assert.True(validator.Validate(Comment.Create(new CommentState { Text = text }), out errors)); }
public void CommentValidator_ThrowsInvalidValueLength() { CommentModel model = new CommentModel { PostId = new Guid("9834d7b9-618d-435b-b86e-d9e861111738"), Value = "too small" }; CommentValidator validator = new CommentValidator(); validator.Validate(model); }
public void CommentValidator_ThrowsEmptyOrNullValue() { CommentModel model = new CommentModel { PostId = new Guid("9834d7b9-618d-435b-b86e-d9e861111738"), Value = String.Empty }; CommentValidator validator = new CommentValidator(); validator.Validate(model); }
/// <summary> /// Method to validate model /// </summary> /// <returns>Returns the result of validation</returns> protected override FluentValidation.Results.ValidationResult Validate() { var validator = new CommentValidator(); return(validator.Validate(this)); }