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")); }
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); }
public static IEnumerable <PropertyVm> For(object target) { return(FF.PropertiesFor(target, target.GetType())); }