public static ControlType ControlType(Type type) { var @class = new Class(type); if ([email protected](typeof (ControlTypeMappingAttribute))) throw new CustomUIItemException("ControlTypeMappingAttribute needs to be defined for this type: " + type.FullName); var controlTypeMappingAttribute = @class.Attribute<ControlTypeMappingAttribute>(); return ControlType(controlTypeMappingAttribute.CustomUIItemType); }
public virtual ApplicationClass ClassFor(object test) { var @class = new Class(test.GetType()); if (@class.HasAttribute(typeof (CategoryAttribute))) { List<CategoryAttribute> categoryAttributes = @class.Attributes<CategoryAttribute>(); if (ContainsName(categoryAttributes, DefaultAppClass)) return DefaultAppClass; string category = categoryAttributes[0].Name; if (categories.ContainsKey(category)) return categories[category]; } return applicationClass.Equals(ApplicationClass.None) ? DefaultAppClass : applicationClass; }
public void HasAttribute() { var @class = new Class(typeof(ClassForClassTest)); Assert.AreEqual(true, @class.HasAttribute(typeof (SerializableAttribute))); Assert.AreEqual(false, @class.HasAttribute(typeof (TestFixtureAttribute))); }