public void input_for_a_different_model() { execute(page => { var model = new ConventionTarget {Name = "Max"}; return page.InputFor(model, x => x.Name); }); theResult.ShouldEqual("<input type=\"text\" value=\"Max\" name=\"Name\" />"); }
public void display_for_a_different_model() { execute(page => { var model = new ConventionTarget { Name = "Max" }; return page.DisplayFor(model, x => x.Name); }); theResult.ShouldEqual("<span id=\"Name\">Max</span>"); }
public void input_for_a_different_model() { execute(page => { var model = new ConventionTarget { Name = "Max" }; return(page.InputFor(model, x => x.Name)); }); theResult.ShouldEqual("<input type=\"text\" value=\"Max\" name=\"Name\" />"); }
public void display_for_a_different_model() { execute(page => { var model = new ConventionTarget { Name = "Max" }; return(page.DisplayFor(model, x => x.Name)); }); theResult.ShouldEqual("<span id=\"Name\">Max</span>"); }
private static bool IsAcceptableTarget(NameSemantic semantic, ConventionTarget target, ITypeDefinition typeDef) { bool acceptable = true; switch (target) { case ConventionTarget.Class: acceptable = typeDef.Kind == TypeKind.Class; break; case ConventionTarget.Struct: acceptable = typeDef.Kind == TypeKind.Struct; break; case ConventionTarget.Enum: acceptable = typeDef.Kind == TypeKind.Enum; break; case ConventionTarget.Interface: acceptable = typeDef.Kind == TypeKind.Interface; break; case ConventionTarget.Delegate: acceptable = typeDef.Kind == TypeKind.Delegate; break; case ConventionTarget.ObjectLiteral: acceptable = semantic.IsObjectLiteral || typeDef.GetAttribute(new FullTypeName("H5.ObjectLiteralAttribute"), false) != null; break; case ConventionTarget.Anonymous: acceptable = typeDef.Kind == TypeKind.Anonymous; break; case ConventionTarget.External: string externalAttr = "H5.ExternalAttribute"; var has = typeDef.Attributes.Any( attr => attr.Constructor != null && attr.Constructor.DeclaringType.FullName == externalAttr); if (!has && typeDef.DeclaringTypeDefinition != null) { has = typeDef.DeclaringTypeDefinition.Attributes.Any( attr => attr.Constructor != null && attr.Constructor.DeclaringType.FullName == externalAttr); } if (!has) { has = H5Types.IsTypeFromH5Core(typeDef.FullName) || typeDef.ParentAssembly.AssemblyAttributes.Any( attr => attr.Constructor != null && attr.Constructor.DeclaringType.FullName == externalAttr); } acceptable = has; break; default: break; } return(acceptable); }
/// <summary> ///Initializes a new instance of the ConventionAttribute class with specified Notation and Target. /// </summary> /// <param name="notation"></param> /// <param name="target">Specifies target(s) to be filtered by [Convention] attribute.</param> public extern ConventionAttribute(Notation notation, ConventionTarget target);
/// <summary> ///Initializes a new instance of the ConventionAttribute class with specified Notation and Target. /// </summary> /// <param name="notation"></param> /// <param name="target">Specifies target(s) to be filtered by [Convention] attribute.</param> public ConventionAttribute(Notation notation, ConventionTarget target) { }