Exemplo n.º 1
0
        public void CreateForumWithEmptyIds()
        {
            NForum.CQS.Commands.Forums.CreateForumCommand create = new CQS.Commands.Forums.CreateForumCommand {
                CategoryId    = String.Empty,
                ParentForumId = String.Empty,
                Name          = "hep"
            };

            NForum.CQS.Validators.Forums.CreateForumValidator validator = new CQS.Validators.Forums.CreateForumValidator(TestUtils.GetInt32IdValidator());

            ValidationResult result = validator.Validate(create);

            result.IsValid.Should().Be(false, "Empty ids is not allowed");

            create.CategoryId    = "    ";
            create.ParentForumId = "    ";
            result = validator.Validate(create);
            result.IsValid.Should().Be(false, "Empty ids is not allowed");

            create.CategoryId    = "\t";
            create.ParentForumId = "\t";
            result = validator.Validate(create);
            result.IsValid.Should().Be(false, "Empty ids is not allowed");

            create.CategoryId    = null;
            create.ParentForumId = null;
            result = validator.Validate(create);
            result.IsValid.Should().Be(false, "Empty ids is not allowed");
        }
Exemplo n.º 2
0
        public void CreateForumWithEmptyName()
        {
            NForum.CQS.Commands.Forums.CreateForumCommand create = new CQS.Commands.Forums.CreateForumCommand {
                CategoryId = 765.ToString(),
                Name       = String.Empty
            };

            NForum.CQS.Validators.Forums.CreateForumValidator validator = new CQS.Validators.Forums.CreateForumValidator(TestUtils.GetInt32IdValidator());

            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");
        }