public void adds_the_horizontal_form_class()
        {
            var request = new FormRequest(null, null);
            request.ReplaceTag(new FormTag("/test"));

            var modifier = new HorizontalFormModifier();
            modifier.Modify(request);

            request.CurrentTag.HasClass("form-horizontal").ShouldBeTrue();
        }
        public void SetUp()
        {
            theServices = new InMemoryServiceLocator();
            theSearch = ChainSearch.ByUniqueInputType(typeof (object));
            theInput = new object();

            theResolver = MockRepository.GenerateStub<IChainResolver>();
            theUrlResolver = MockRepository.GenerateStub<IChainUrlResolver>();

            theChain = new BehaviorChain();

            theServices.Add(theResolver);
            theServices.Add(theUrlResolver);

            theRequest = new FormRequest(theSearch, theInput);
        }
Exemplo n.º 3
0
        public static ValidationOptions For(FormRequest request)
        {
            var services = request.Services;
            var type = services.GetInstance<ITypeResolver>().ResolveType(request.Input);
            var cache = services.GetInstance<ITypeDescriptorCache>();
            var options = new ValidationOptions();
            var node = request.Chain.ValidationNode() as IValidationNode;

            if (node == null)
            {
                return options;
            }

            // TODO -- Let's query the validation graph and register the rule alias/validation mode pairs here
            cache.ForEachProperty(type, property =>
            {
                var accessor = new SingleProperty(property);

                fillFields(options, node, services, accessor);
            });

            return options;
        }
        public static ValidationOptions For(FormRequest request)
        {
            var services = request.Services;
            var type = services.GetInstance<ITypeResolver>().ResolveType(request.Input);
            var cache = services.GetInstance<ITypeDescriptorCache>();
            var options = new ValidationOptions();
            var node = request.Chain.ValidationNode();

            if (node == null)
            {
                return options;
            }

            options._elementTimeout = node.ElementTimeout;

            cache.ForEachProperty(type, property =>
            {
                var accessor = new SingleProperty(property);

                fillFields(options, node, services, accessor);
            });

            return options;
        }
Exemplo n.º 5
0
 public static ValidationMode For(FormRequest request)
 {
     var validation = request.Chain.ValidationNode();
     return validation == null ? None : validation.Mode;
 }
Exemplo n.º 6
0
 protected bool Equals(FormRequest other)
 {
     return(Equals(_search, other._search) && Equals(_input, other._input));
 }
Exemplo n.º 7
0
 protected bool Equals(FormRequest other)
 {
     return Equals(_search, other._search) && Equals(_input, other._input);
 }
Exemplo n.º 8
0
 public void SetUp()
 {
     theRequest = new FormRequest(new ChainSearch {Type = typeof (object)}, new object());
     var theForm = new FormTag("test");
     theRequest.ReplaceTag(theForm);
 }
Exemplo n.º 9
0
 public void Modify(FormRequest request)
 {
     _modify(request);
 }