public void SetUp() { theSelfValidatingSource = new SelfValidatingClassRuleSource(); theFieldRegistry = new FieldRulesRegistry(new IFieldValidationSource[0], new TypeDescriptorCache()); theGraph = new ValidationGraph(theFieldRegistry, new IValidationSource[0]); }
public void SetUp() { theBehaviorGraph = BehaviorGraph.BuildFrom(r => { r.Actions.IncludeType<RemoteRuleGraphEndpoint>(); r.Features.Validation.Enable(true); }); theValidationGraph = ValidationGraph.BasicGraph(); theRuleGraph = new RemoteRuleGraph(); theQuery = RemoteRuleQuery.Basic(); theActivator = new RemoteRuleGraphActivator(theValidationGraph, theRuleGraph, theBehaviorGraph, theQuery, new TypeDescriptorCache()); theActivator.Activate(new ActivationLog(), new PerfTimer()); }
public static ValidationPlan For(Type type, ValidationGraph graph) { var steps = new List <ValidationStep>(); graph.Sources.Each(source => { var rules = source.RulesFor(type); if (!rules.Any()) { return; } steps.Add(new ValidationStep(type, source.GetType(), rules)); }); return(new ValidationPlan(type, steps)); }
void IValidationRegistration.Register(ValidationGraph graph) { _rules.Each(r => r.Register(graph.Fields)); graph.RegisterSource(this); }
public void Register(ValidationGraph graph) { Configured = graph; }
public static IValidator BasicValidator() { return(new Validator(new TypeResolver(), ValidationGraph.BasicGraph(), new InMemoryServiceLocator())); }
public Validator(ITypeResolver typeResolver, ValidationGraph graph, IServiceLocator services) { _typeResolver = typeResolver; _graph = graph; _services = services; }
public void SetUp() { theModel = new ContactModel(); theType = theModel.GetType(); r1 = MockRepository.GenerateStub<IValidationRule>(); r2 = MockRepository.GenerateStub<IValidationRule>(); r3 = MockRepository.GenerateStub<IValidationRule>(); theMatchingSource = ConfiguredValidationSource.For(type => type == theType, r1, r2); theOtherSource = ConfiguredValidationSource.For(type => type == typeof(int), r3); theGraph = ValidationGraph.BasicGraph(); theGraph.RegisterSource(theMatchingSource); theGraph.RegisterSource(theOtherSource); theContext = ValidationContext.For(theModel); thePlan = ValidationPlan.For(theType, theGraph); }