コード例 #1
0
 public ValidationTests()
 {
     createArticleCommandValidator = new CreateArticleCommandValidator();
     updateArticleCommandValidator = new UpdateArticleCommandValidator();
     addReviewCommandValidator     = new AddReviewCommandValidator();
     updateReviewCommandValidator  = new UpdateReviewCommandValidator();
     removeReviewCommandValidator  = new RemoveReviewCommandValidator();
     deleteArticleCommandValidator = new DeleteArticleCommandValidator();
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }