public ValidationTests() { createArticleCommandValidator = new CreateArticleCommandValidator(); updateArticleCommandValidator = new UpdateArticleCommandValidator(); addReviewCommandValidator = new AddReviewCommandValidator(); updateReviewCommandValidator = new UpdateReviewCommandValidator(); removeReviewCommandValidator = new RemoveReviewCommandValidator(); deleteArticleCommandValidator = new DeleteArticleCommandValidator(); }
public void IsValidShouldBeTrueWhenTitleIsNotNull() { var command = new CreateArticleCommand { Title = "Test Title", Content = "Test Content" }; var validator = new CreateArticleCommandValidator(); var result = validator.Validate(command); result.IsValid.ShouldBe(true); }
public void IsValidShouldBeFalseWhenTitleIsMoreThanFortySymbols() { var command = new CreateArticleCommand { Title = new string('A', 50), Content = "Test Content" }; var validator = new CreateArticleCommandValidator(); var result = validator.Validate(command); result.IsValid.ShouldBe(false); }