public void ShouldReturnEmptyCollectionForMissingProperty() { IEnumerable <Attribute> properties = MetadataRepository.GetAttributes(new MyEntity(), "Missing"); Assert.IsNotNull(properties); Assert.AreEqual <int>(0, properties.Count()); }
public void ShouldCollectTypeAttributes() { List <Attribute> attributes = MetadataRepository.GetAttributes(new MyEntity()).ToList(); Assert.AreEqual <int>(1, attributes.Count); MyCustomAttribute attr = attributes[0] as MyCustomAttribute; Assert.IsNotNull(attr); Assert.AreEqual <string>("MyEntity", attr.Name); }
public void ShouldReturnPropertyAttributes() { List <Attribute> attributes = MetadataRepository.GetAttributes(new MyEntity(), "FirstName").ToList(); Assert.AreEqual <int>(7, attributes.Count); MetadataRepository.Clear(); MetadataRepository.GetProperties(new MyEntity()); attributes = MetadataRepository.GetAttributes(new MyEntity(), "FirstName").ToList(); Assert.AreEqual <int>(7, attributes.Count); }
public void ShouldFailCollectingPropertyAttributes_2() { MetadataRepository.GetAttributes(typeof(MyEntity), null); }
public void ShouldFailCollectingPropertyAttributes_1() { MetadataRepository.GetAttributes(null, "property"); }
public void ShouldFailCollectingTypeAttributes() { MetadataRepository.GetAttributes(null); }