public override bool validate() { if (submodel != null) { SystemValidator validator = new SystemValidator(entities, submodel.getResources()); return(validator.startValidation().Success); } return(true); }
public void test_shouldThrowNotOneDestException() { instance.addEntity(new EntityStart()); instance.addEntity(new EntityDestination()); instance.addEntity(new EntityDestination()); IValidator validator = new SystemValidator(instance.getEntities(), instance.getResources()); Assert.IsFalse(validator.startValidation().Success); }
protected override void Load(ContainerBuilder builder) { // registers type validators builder.RegisterGenerics(typeof(IValidator <>)); // registers the Object Validator and configures the Ambient Singleton container builder .Register(context => SystemValidator.SetFactory(() => new FluentValidationObjectValidator(context.Resolve <IDependencyResolver>()))) .As <IObjectValidator>() .InstancePerLifetimeScope() .AutoActivate(); }
public void validate() { foreach (Entity ent in entities) { model.addEntity(ent); } SystemValidator validator = new SystemValidator(model.getEntities(), model.getResources()); ValidationResult result = validator.startValidation(); if (!result.Success) { ValidationException ex = new ValidationException(); foreach (ValidationError err in result.Errors) { ex.addError(err.Message, err.FailedEntity); } throw ex; } }
public Tests() { validator = new SystemValidator(); }