public void GetAttributeFromTypeReturnsNullIfAttributeIsNotPresentOnType() { Type type = typeof(Person); TestMember1Attribute attribute = type.GetAttribute <TestMember1Attribute>(); Assert.IsNull(attribute); }
public void GetAttributeFromMemberReturnsAttribute() { Expression <Func <Person, int> > selector = p => p.Age; PropertyInfo property = selector.GetPropertyInfo(); TestMember1Attribute attribute = property.GetAttribute <TestMember1Attribute>(); Assert.IsNotNull(attribute); Assert.AreEqual(4, attribute.Id); }