public void no_registration_when_no_rules_are_found()
        {
            theRemoteGraph = new RemoteRuleGraph();
            theServices.Add(theRemoteGraph);

            theModifier.Modify(theRequest);

            theRequest.CurrentTag.Data("remote-rule").ShouldBeNull();
        }
        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()
        {
            theModifier = new RemoteValidationElementModifier();
            theTag      = new HtmlTag("input");

            theRequest = ElementRequest.For <RemoteTarget>(x => x.Username);
            theRequest.ReplaceTag(theTag);

            theRemoteGraph = new RemoteRuleGraph();
            theRemoteRule  = theRemoteGraph.RegisterRule(theRequest.Accessor, new UniqueUsernameRule());

            theUrls = new StubUrlRegistry();

            theServices = new InMemoryServiceLocator();
            theServices.Add(theRemoteGraph);
            theServices.Add(theUrls);

            theRequest.Attach(theServices);
        }
        protected override void beforeEach()
        {
            var theAccessor = ReflectionHelper.GetAccessor <ValidateFieldTarget>(x => x.Name);

            theGraph = new RemoteRuleGraph();
            theGraph.RegisterRule(theAccessor, new RequiredFieldRule());

            Services.Inject(theGraph);

            theRemoteRule = RemoteFieldRule.For(theAccessor, new RequiredFieldRule());

            theInputModel = new ValidateField {
                Hash = theRemoteRule.ToHash(), Value = "Test"
            };

            theNotification = new Notification();
            theContinuation = new AjaxContinuation();

            MockFor <IRuleRunner>().Stub(x => x.Run(theRemoteRule, theInputModel.Value)).Return(theNotification);
            MockFor <IAjaxContinuationResolver>().Stub(x => x.Resolve(theNotification)).Return(theContinuation);
        }
 public void SetUp()
 {
     theGraph = new RemoteRuleGraph();
 }