public void Should_have_error_when_blog_title_already_exists()
        {
            const string blogTitle = "My Blog";

            var blogRepository = new Mock <IBlogRepository>();

            blogRepository.Setup(x => x.GetByTitle(blogTitle)).Returns(Domain.Blog.Blog.CreateNew(blogTitle));

            var validator = new CreateBlogCommandValidator(blogRepository.Object);

            validator.ShouldHaveValidationErrorFor(x => x.Title, new CreateBlogCommand(blogTitle));
        }
Ejemplo n.º 2
0
 public override bool IsValid()
 {
     ValidationResult = new CreateBlogCommandValidator().Validate(this);
     return(base.IsValid());
 }