public void setup() { var registry = new FieldRulesRegistry(new[] { new AttributeFieldValidationSource() }, new TypeDescriptorCache()); _query = new FieldValidationQuery(registry); }
public void SetUp() { theRegistry = new FieldRulesRegistry(new [] { new AttributeFieldValidationSource() }, new TypeDescriptorCache()); theRules = theRegistry.RulesFor <AttributeScanningTarget>(); }
public void SetUp() { theSelfValidatingSource = new SelfValidatingClassRuleSource(); theFieldRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); theGraph = new ValidationGraph(theFieldRegistry, new IValidationSource[0]); }
public void SetUp() { theSelfValidatingSource = new SelfValidatingClassRuleSource(); theFieldRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); theGraph = new ValidationGraph(theFieldRegistry, new IValidationSource[0]); }
public void SetUp() { theRegistry = new FieldRulesRegistry(new [] { new AttributeFieldValidationSource()}, new TypeDescriptorCache()); theRules = theRegistry.RulesFor<AttributeScanningTarget>(); }
private IEnumerable <IFieldValidationRule> rulesFor(Expression <Func <ValidationRegistryTarget, object> > expression) { var registry = new FieldRulesRegistry(TypeExtensions.As <IValidationRegistration>(theRegistry).FieldSources(), new TypeDescriptorCache()); TypeExtensions.As <IValidationRegistration>(theRegistry).RegisterFieldRules(registry); return(registry.RulesFor <ValidationRegistryTarget>(expression)); }
private IEnumerable <IFieldValidationRule> rulesFor(Expression <Func <ClassValidationRulesTarget, object> > expression) { var registry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); registry.Import(theRules); return(registry.RulesFor(typeof(ClassValidationRulesTarget)).RulesFor(expression.ToAccessor())); }
public ScenarioDefinition() { _sources = new List <IValidationSource> { new ConfiguredValidationSource(_rules) }; var fieldSource = new PassThruFieldValidationSource(_fieldRules); _fieldRegistry = FieldRulesRegistry.Explicit(new IFieldValidationSource[] { fieldSource }); }
public void SetUp() { source1 = new StubFieldValidationSource <FieldAccessRuleRegistryTarget>(); source2 = new StubFieldValidationSource <FieldAccessRuleRegistryTarget>(); source1.Register <RequiredFieldRule>(x => x.Name); source2.Register <RequiredFieldRule>(x => x.Name); source2.Register <GreaterThanZeroRule>(x => x.Age); source1.Register <GreaterOrEqualToZeroRule>(x => x.Children); theRegistry = new FieldRulesRegistry(new IFieldValidationSource[] { source1, source2 }, new TypeDescriptorCache()); }
public ValidationBootstrapRegistry() { var validationRegistry = new ScratchpadValidationRegistry() as IValidationRegistration; var registry = new FieldRulesRegistry(validationRegistry.FieldSources(), new TypeDescriptorCache()); validationRegistry.RegisterFieldRules(registry); For<IValidationSource>() .Add(new FieldRuleSource(registry)); For<IValidationFailureHandler>() .Use<ValidationFailureHandler>(); For<IValidationFailurePolicy>() .Add<JsonValidationFailurePolicy>(); For<IFieldRulesRegistry>() .Use(registry); For<IValidator>().Use<Validator>(); }
public ValidationBootstrapRegistry() { var validationRegistry = new ScratchpadValidationRegistry() as IValidationRegistration; var registry = new FieldRulesRegistry(validationRegistry.FieldSources(), new TypeDescriptorCache()); validationRegistry.RegisterFieldRules(registry); For <IValidationSource>() .Add(new FieldRuleSource(registry)); For <IValidationFailureHandler>() .Use <ValidationFailureHandler>(); For <IValidationFailurePolicy>() .Add <JsonValidationFailurePolicy>(); For <IFieldRulesRegistry>() .Use(registry); For <IValidator>().Use <Validator>(); }
void IFubuRegistryExtension.Configure(FubuRegistry registry) { registry .Services(x => { var validationRegistry = _validationRegistry as IValidationRegistration; var rulesRegistry = new FieldRulesRegistry(validationRegistry.FieldSources(), new TypeDescriptorCache()); validationRegistry.RegisterFieldRules(rulesRegistry); x.AddService<IValidationSource>(new FieldRuleSource(rulesRegistry)); x.SetServiceIfNone<IFieldRulesRegistry>(rulesRegistry); x.SetServiceIfNone<IValidator, Validator>(); x.SetServiceIfNone<IValidationQuery, ValidationQuery>(); x.SetServiceIfNone<IValidationContinuationHandler, ValidationContinuationHandler>(); x.SetServiceIfNone<IFieldValidationQuery, FieldValidationQuery>(); x.SetServiceIfNone<IValidationFailureHandler, ValidationFailureHandler>(); _validationPolicies .Each(policy => x.AddService(typeof(IValidationFailurePolicy), policy)); }); registry .ApplyConvention(new ValidationConvention(_callMatcher.CallFilters.Matches)); }
/// <summary> /// Mostly used for testing. Sets up a ValidationGraph for a given source. /// </summary> /// <param name="source"></param> /// <returns></returns> public static ValidationGraph For(IValidationSource source) { return(new ValidationGraph(FieldRulesRegistry.BasicRegistry(), new[] { source })); }
public static ValidationGraph BasicGraph() { return(new ValidationGraph(FieldRulesRegistry.BasicRegistry(), new IValidationSource[0])); }
private IEnumerable<IFieldValidationRule> rulesFor(Expression<Func<ClassValidationRulesTarget, object>> expression) { var registry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); registry.Import(theRules); return registry.RulesFor(typeof (ClassValidationRulesTarget)).RulesFor(expression.ToAccessor()); }
public void SetUp() { var fieldRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); _provider = new Validator(new TypeResolver(), new IValidationSource[] { new FieldRuleSource(fieldRegistry) }); }
private IEnumerable<IFieldValidationRule> rulesFor(Expression<Func<ValidationRegistryTarget, object>> expression) { var registry = new FieldRulesRegistry(TypeExtensions.As<IValidationRegistration>(theRegistry).FieldSources(), new TypeDescriptorCache()); TypeExtensions.As<IValidationRegistration>(theRegistry).RegisterFieldRules(registry); return registry.RulesFor<ValidationRegistryTarget>(expression); }
public void setup() { var registry = new FieldRulesRegistry(new[] {new AttributeFieldValidationSource()}, new TypeDescriptorCache()); _query = new FieldValidationQuery(registry); }
private IEnumerable <IFieldValidationRule> rulesFor(Expression <Func <LambdaFieldValidationSourceTarget, object> > expression) { var registry = new FieldRulesRegistry(new IFieldValidationSource[] { theSource }, new TypeDescriptorCache()); return(registry.RulesFor <LambdaFieldValidationSourceTarget>(expression)); }
private IEnumerable<IFieldValidationRule> rulesFor(Expression<Func<LambdaFieldValidationSourceTarget, object>> expression) { var registry = new FieldRulesRegistry(new IFieldValidationSource[]{theSource}, new TypeDescriptorCache()); return registry.RulesFor<LambdaFieldValidationSourceTarget>(expression); }
public void SetUp() { theRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); }
public void SetUp() { theRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); }
public void SetUp() { var fieldRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); _provider = new Validator(new TypeResolver(), new IValidationSource[] { new FieldRuleSource(fieldRegistry) }); }