Exemplo n.º 1
0
        public void CreateCategoryWithName()
        {
            NForum.CQS.Commands.Categories.CreateCategoryCommand create = new CQS.Commands.Categories.CreateCategoryCommand {
                Name = "Just anything"
            };

            NForum.CQS.Validators.Categories.CreateCategoryValidator validator = new CQS.Validators.Categories.CreateCategoryValidator();

            ValidationResult result = validator.Validate(create);

            result.IsValid.Should().Be(true, "A name was provided");
        }
Exemplo n.º 2
0
        public void CreateCategoryWithEmptyName()
        {
            NForum.CQS.Commands.Categories.CreateCategoryCommand create = new CQS.Commands.Categories.CreateCategoryCommand {
                Name = String.Empty
            };

            NForum.CQS.Validators.Categories.CreateCategoryValidator validator = new CQS.Validators.Categories.CreateCategoryValidator();

            ValidationResult result = validator.Validate(create);

            result.IsValid.Should().Be(false, "An empty name is not allowed");

            create.Name = "    ";
            result      = validator.Validate(create);
            result.IsValid.Should().Be(false, "An empty name is not allowed");

            create.Name = "\t";
            result      = validator.Validate(create);
            result.IsValid.Should().Be(false, "An empty name is not allowed");

            create.Name = null;
            result      = validator.Validate(create);
            result.IsValid.Should().Be(false, "An empty name is not allowed");
        }