Пример #1
0
        private IGrammar setter(Expression<Func<AuthenticationSettings, object>> property)
        {
            var accessor = property.ToAccessor();
            var grammar = new SetPropertyGrammar(accessor.InnerProperty);
            grammar.CellModifications.DefaultValue(accessor.GetValue(new AuthenticationSettings()).ToString());

            return grammar;
        }
Пример #2
0
 public void SetUp()
 {
     _page = MockRepository.GenerateStub<IFubuPage<ViewModel>>();
     _convention = MockRepository.GenerateStub<IElementNamingConvention>();
     _expression = (x=>x.Property);
     _accessor = _expression.ToAccessor();
     _convention.Stub(c => c.GetName(Arg<Type>.Is.Equal(typeof (ViewModel)), Arg<Accessor>.Is.Equal(_accessor))).Return("name");
     _page.Stub(p => p.Get<IElementNamingConvention>()).Return(_convention);
 }
Пример #3
0
        private FileSet buildFileSet(XmlDocument document, Expression<Func<PackageManifest, object>> expression)
        {
            var node = document.DocumentElement.SelectSingleNode(expression.ToAccessor().Name) as XmlElement;

            var fileSet = new FileSet();

            if (node == null) return fileSet;

            if (node.HasAttribute("Include"))
            {
                fileSet.Include = node.GetAttribute("Include");
            }

            if (node.HasAttribute("Exclude"))
            {
                fileSet.Exclude = node.GetAttribute("Exclude");
            }

            var deepSearchNode = node.SelectSingleNode("DeepSearch");
            if (deepSearchNode != null) fileSet.DeepSearch = bool.Parse(deepSearchNode.InnerText);

            return fileSet;
        }
Пример #4
0
 private Argument argFor(Expression<Func<ArgumentTarget, object>> property)
 {
     return new Argument(property.ToAccessor().InnerProperty, new ObjectConverter());
 }
Пример #5
0
 private BooleanFlag getFlag(Expression<Func<BooleanFlagTarget, object>> expression)
 {
     return new BooleanFlag(expression.ToAccessor().InnerProperty);
 }
 private IEnumerable<IFieldValidationRule> rulesFor(Expression<Func<AttributeScanningTarget, object>> expression)
 {
     return theRules.RulesFor(expression.ToAccessor());
 }
        public string format(Expression<Func<DateTimeFormattingTarget, object>> expression, object value)
        {
            var accessor = expression.ToAccessor();

            return _formatter.GetDisplayForValue(accessor, value);
        }
Пример #8
0
 private ITokenHandler handlerFor(Expression<Func<InputModel, object>> expression)
 {
     var property = expression.ToAccessor().InnerProperty;
     return new InputParser().BuildHandler(property);
 }
Пример #9
0
 // TODO (checked) -- this needs to be in ScreenFixture, Serenity
 protected IWebElement findElement(Expression<Func<LoginRequest, object>> property)
 {
     return Driver.FindElement(By.Name(property.ToAccessor().Name));
 }
        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());
        }
 private Accessor accessorFor(Expression<Func<RemoteFieldModel, object>> expression)
 {
     return expression.ToAccessor();
 }
 private ElementRequest For(Expression<Func<AddressViewModel, object>> expression)
 {
     return new ElementRequest(new AddressViewModel(), expression.ToAccessor(), null, new Stringifier());
 }
Пример #13
0
 private HtmlTag For(Expression<Func<Address, object>> expression)
 {
     Accessor accessor = expression.ToAccessor();
     var request = new ElementRequest(address, accessor, null);
     request.ElementId = accessor.Name;
     return factory.Build(request);
 }
 private Accessor accessor(Expression<Func<TestCsvObject, object>> expression)
 {
     return expression.ToAccessor();
 }
Пример #15
0
 private Flag forProp(Expression<Func<FlagTarget, object>> expression)
 {
     return new Flag(expression.ToAccessor().InnerProperty, new ObjectConverter());
 }