public void Should_get_the_description() { const string uiDescription = "test"; var descriptor = new UIDescriptionAttribute(uiDescription); var description = descriptor.UIDescription; description.ShouldBeEqualTo(uiDescription); }
public void Should_get_the_description_with_type_reference_replaced_by_its_ui_description() { string uiDescription = "a $"+typeof(ObjectWithDescription).Name+" test"; var descriptor = new UIDescriptionAttribute(uiDescription); var description = descriptor.UIDescription; description.ShouldBeEqualTo("a "+typeof(ObjectWithDescription).GetSingularUIDescription()+" test"); }
public void Should_get_the_description_with_type_reference_replaced_by_its_ui_description() { string uiDescription = "a $" + typeof(ObjectWithDescription).Name + " test"; var descriptor = new UIDescriptionAttribute(uiDescription); var description = descriptor.UIDescription; description.ShouldBeEqualTo("a " + typeof(ObjectWithDescription).GetSingularUIDescription() + " test"); }
public void Should_get_the_description() { const string uiDescription = "test"; var descriptor = new UIDescriptionAttribute(uiDescription); var description = descriptor.UIDescription; description.ShouldBeEqualTo(uiDescription); }
public static string EasyUIControlString(this HtmlHelper htmlHelper, object model, PropertyInfo property, UIDescriptionAttribute attr, bool withDiv = true) { string str = ""; var html = GetControlType(attr.uiclass); str = $"<{html} id=\"{property.Name}\" name=\"{property.Name}\" class=\"user-edit easyui-{attr.uiclass}\" style = \"width:100%;\" data-options=\"label: '{attr.caption}',labelPosition:'{attr.labelPosition}', prompt:'{attr.prompt}'"; #region data-options if (attr.required) { str += $",required:true"; } if (attr.precision > 0) { str += $",precision:{attr.precision}"; } if (!attr.icons.IsEmpty()) { str += $",icons:{attr.icons}"; } #endregion str += $"\" value = \"{property.GetValue(model, null)}\"/>"; if (withDiv) { str = string.Format("<div {0} class=\"control-group\"> <div class=\"controls\">{1}<span class=\"help-block\"></span></div> </div>", attr.hidden ? "hidden=\"hidden\"" : "", str); } return(str); }