public void UsingTryValidateModelOnAnEntityWithoutPropertyRequirementsMustBeInvalid()
 {
     TestController controller = new TestController();
     var entity = new TestEntity();
     bool result = controller.TryValidate(entity);
     Assert.IsFalse(result);
     Assert.AreEqual(1, entity.Validate(null).Count());
 }
 public void UsingTryValidateModelOnAnEntityWithBothCustomValidationRulesAndBasicRulesInvalidShouldReturnBothErrorMessages()
 {
     TestController controller = new TestController();
     CustomValidateEntity entity = new CustomValidateEntity();
     bool result = controller.TryValidate(entity);
     Assert.IsFalse(result);
     Assert.AreEqual(2, entity.Validate(null).Count());
 }
 public void UsingTryValidateModelOnAnEntityWithPropertyRequirementsNotMetButCustomValidationRulesMetMustBeInvalid()
 {
     TestController controller = new TestController();
     CustomValidateEntity entity = new CustomValidateEntity();
     entity.Name = "TestEntity";
     bool result = controller.TryValidate(entity);
     Assert.IsFalse(result);
     Assert.AreEqual(1, entity.Validate(null).Count());
 }
 public void UsingTryValidateModelOnAnEntityWithCustomValidationRulesMetMustBeValid()
 {
     TestController controller = new TestController();
     CustomValidateEntity entity = new CustomValidateEntity();
     entity.Number = 1;
     entity.Name = "TestEntity";
     bool result = controller.TryValidate(entity);
     Assert.IsTrue(result);
 }
 public void UsingTryValidateModelOnAnEntityWithCustomValidationRulesNotMetMustBeInValid()
 {
     TestController controller = new TestController();
     CustomValidateEntity entity = new CustomValidateEntity();
     entity.Number = 1;
     entity.Name = "Just another entity";
     bool result = controller.TryValidate(entity);
     Assert.IsFalse(result);
     Assert.AreEqual(1, entity.Validate(null).Count());
 }