public void ParseAssembly(Assembly assembly) { foreach (Type type in assembly.GetTypes()) { DataObjectAttribute doa = type.GetCustomAttribute <DataObjectAttribute>(); if (doa != null) { DataType dt = new DataType(type); mKnownTypes.Add(dt.FullName, dt); } } }
public static IEnumerable <object[]> Equals_TestData() { var attribute = new DataObjectAttribute(true); yield return(new object[] { attribute, attribute, true }); yield return(new object[] { attribute, new DataObjectAttribute(true), true }); yield return(new object[] { attribute, new DataObjectAttribute(false), false }); yield return(new object[] { attribute, new object(), false }); yield return(new object[] { attribute, null, false }); }
/// <summary>构造函数</summary> /// <param name="table"></param> /// <param name="property"></param> public FieldItem(TableItem table, PropertyInfo property) { if (property == null) { throw new ArgumentNullException("property"); } _Table = table; _Property = property; _Column = BindColumnAttribute.GetCustomAttribute(_Property); _DataObjectField = DataObjectAttribute.GetCustomAttribute(_Property, typeof(DataObjectFieldAttribute)) as DataObjectFieldAttribute; _Description = DescriptionAttribute.GetCustomAttribute(_Property, typeof(DescriptionAttribute)) as DescriptionAttribute; }
public void GetHashCode_Invoke_ReturnsExpected(bool isDataObject) { var attribute = new DataObjectAttribute(isDataObject); Assert.Equal(isDataObject.GetHashCode(), attribute.GetHashCode()); }
public void Equals_Other_ReturnsExpected(DataObjectAttribute attribute, object other, bool expected) { Assert.Equal(expected, attribute.Equals(other)); }
public void Ctor_IsDataObject(bool isDataObject) { var attribute = new DataObjectAttribute(isDataObject); Assert.Equal(isDataObject, attribute.IsDataObject); }
public void Ctor_Default() { var attribute = new DataObjectAttribute(); Assert.True(attribute.IsDataObject); }