示例#1
0
        public async Task Test()
        {
            var someObject = new SomeType()
            {
                SomeProperty = "SomeValue"
            };
            var properties = FF.PropertiesFor(someObject);

            var html       = properties.Render();
            var annotation = new FormFactory.Attributes.DisplayAttribute();
            var actualCq   = CQ.CreateFragment(html.ToString());
            var input      = actualCq.Find("input").Single(el => el.GetAttribute("name") == "SomeProperty");

            Assert.AreEqual("SomeValue", input.GetAttribute("value"));
        }
示例#2
0
        public ObjectChoices[] Choices(PropertyVm model) //why is this needed? HM
        {
            var html    = this;
            var choices = (from obj in model.Choices.Cast <object>().ToArray()
                           let choiceType = obj == null ? model.Type : obj.GetType()
                                            let properties = FF.PropertiesFor(obj, choiceType)
                                                             .Each(p => p.Name = model.Name + "." + p.Name)
                                                             .Each(p => p.Readonly |= model.Readonly)
                                                             .Each(p => p.Id = Guid.NewGuid().ToString())
                                                             select new ObjectChoices {
                obj = obj, choiceType = choiceType, properties = properties, name = (obj != null ? obj.DisplayName() : choiceType.DisplayName())
            }).ToArray();

            return(choices);
        }
示例#3
0
 public static IEnumerable <PropertyVm> For(object target)
 {
     return(FF.PropertiesFor(target, target.GetType()));
 }