private FormRequest createRequest() { var rules = new AccessorRules(); var overrides = new ValidationOptionsTargetOverrides().As <IAccessorRulesRegistration>(); overrides.AddRules(rules); var services = new InMemoryServiceLocator(); services.Add <IChainResolver>(new ChainResolutionCache(theGraph)); services.Add(rules); services.Add <IChainUrlResolver>(new ChainUrlResolver(new OwinHttpRequest())); services.Add <ITypeResolver>(new TypeResolver()); services.Add <ITypeDescriptorCache>(new TypeDescriptorCache()); var graph = ValidationGraph.BasicGraph(); graph.Fields.FindWith(new AccessorRulesFieldSource(rules)); services.Add(graph); var request = new FormRequest(new ChainSearch { Type = typeof(ValidationOptionsTarget) }, new ValidationOptionsTarget()); request.Attach(services); request.ReplaceTag(new FormTag("test")); return(request); }
public ScenarioDefinition() { Tag = new HtmlTag("input"); Services = new InMemoryServiceLocator(); Modifier = new T(); Services.Add(ValidationGraph.BasicGraph()); }
protected override void beforeEach() { theGraph = ValidationGraph.BasicGraph(); Services.Inject(theGraph); theTypes = new TypePool(); theTypes.AddType <RegistrationTargetRules>(); Services.PartialMockTheClassUnderTest(); ClassUnderTest.Stub(x => x.Types()).Return(theTypes); ClassUnderTest.Activate(new IPackageInfo[0], new PackageLog()); }
public void SetUp() { theRequest = ElementRequest.For <FieldValidationModifierTarget>(x => x.Name); theModifier = new FieldValidationElementModifier(); theFieldModifier = MockRepository.GenerateStub <IFieldValidationModifier>(); theRequest.ReplaceTag(new HtmlTag("input")); theServices = new InMemoryServiceLocator(); theServices.Add(ValidationGraph.BasicGraph()); theServices.Add(theFieldModifier); theRequest.Attach(theServices); }
public void SetUp() { theBehaviorGraph = BehaviorGraph.BuildFrom(r => { r.Actions.IncludeType <RemoteRuleGraphEndpoint>(); r.Import <FubuMvcValidation>(); }); theValidationGraph = ValidationGraph.BasicGraph(); theRuleGraph = new RemoteRuleGraph(); theQuery = RemoteRuleQuery.Basic(); theActivator = new RemoteRuleGraphActivator(theValidationGraph, theRuleGraph, theBehaviorGraph, theQuery, new TypeDescriptorCache()); theActivator.Activate(new IPackageInfo[0], new PackageLog()); }
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 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); }