Exemplo n.º 1
0
 public ValidationTests()
 {
     createArticleCommandValidator = new CreateArticleCommandValidator();
     updateArticleCommandValidator = new UpdateArticleCommandValidator();
     addReviewCommandValidator     = new AddReviewCommandValidator();
     updateReviewCommandValidator  = new UpdateReviewCommandValidator();
     removeReviewCommandValidator  = new RemoveReviewCommandValidator();
     deleteArticleCommandValidator = new DeleteArticleCommandValidator();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }