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"); }
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"); }
public void CreateForumWithNameAndParentId() { NForum.CQS.Commands.Forums.CreateForumCommand create = new NForum.CQS.Commands.Forums.CreateForumCommand { Name = "Just anything", ParentForumId = 23456.ToString() }; NForum.CQS.Validators.Forums.CreateForumValidator validator = new CQS.Validators.Forums.CreateForumValidator(TestUtils.GetInt32IdValidator()); ValidationResult result = validator.Validate(create); result.IsValid.Should().Be(true, "A name and parent forum or category id was provided"); create.ParentForumId = String.Empty; create.CategoryId = 34567.ToString(); result = validator.Validate(create); result.IsValid.Should().Be(true, "A name and parent forum or category id was provided"); }