public void DescriptionFor_Attribute_Defined(Type attributeType, string attributePropertyName, object attributePropertyValue) { // Arrange & Act & Assert var propertyInfo = TypeAssert.PropertyHasAttribute <DescriptionTagHelper>("DescriptionFor", attributeType); AttributeAssert.ValidateProperty(propertyInfo, attributeType, attributePropertyName, attributePropertyValue); }
public void Data_XmlElementAttribute_Defined() { // Arrange & Act & Assert var propertyInfo = TypeAssert.PropertyHasAttribute <Resx>("Data", typeof(XmlElementAttribute)); AttributeAssert.ValidateProperty(propertyInfo, typeof(XmlElementAttribute), nameof(XmlElementAttribute.ElementName), "data"); }
public void Value_XmlElementAttribute_Defined() { // Arrange & Act & Assert var propertyInfo = TypeAssert.PropertyHasAttribute <Resx.DataNode>("Value", typeof(XmlElementAttribute)); AttributeAssert.ValidateProperty(propertyInfo, typeof(XmlElementAttribute), nameof(XmlElementAttribute.ElementName), "value"); }
public void Name_XmlAttributeAttribute_Defined() { // Arrange & Act & Assert var propertyInfo = TypeAssert.PropertyHasAttribute <Resx.DataNode>("Name", typeof(XmlAttributeAttribute)); AttributeAssert.ValidateProperty(propertyInfo, typeof(XmlAttributeAttribute), nameof(XmlAttributeAttribute.AttributeName), "name"); }
public void Attribute_Defined(Type attributeType, string firstAttributePropertyName, object firstAttributePropertyValue, string secondAttributePropertyName, object secondAttributePropertyValue) { // Arrange & Act & Assert var typeInfo = TypeAssert.HasAttribute <DescriptionTagHelper>(attributeType); AttributeAssert.ValidateProperty(typeInfo, attributeType, firstAttributePropertyName, firstAttributePropertyValue); AttributeAssert.ValidateProperty(typeInfo, attributeType, secondAttributePropertyName, secondAttributePropertyValue); }
public void Id_Attribute_Defined(Type attributeType, string attributePropertyName, object attributePropertyValue) { // Arrange & Act & Assert var propertyInfo = TypeAssert.PropertyHasAttribute <Entity <int> >("Id", attributeType); if (attributePropertyName != null) { AttributeAssert.ValidateProperty(propertyInfo, attributeType, attributePropertyName, attributePropertyValue); } }
public void ValidateProperty_ProtectedProperty_Success() { // Arrange & Act & Assert AttributeAssert.ValidateProperty( typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)), typeof(FakePropertyAttribute), "ProtectedValue", "TestProtectedValue" ); }
public void ValidateProperty_ThrowsNotNullExceptionIfNoAttribute() { // Arrange & Act & Assert Assert.Throws <NotNullException>( () => AttributeAssert.ValidateProperty( typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)), typeof(FakeClassAttribute), "NoSuchProperty", "TestValue" ) ); }
public void ValidateProperty_ThrowsEqualExceptionIfAttributePropertyValueNotEqual() { // Arrange & Act & Assert Assert.Throws <EqualException>( () => AttributeAssert.ValidateProperty( typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)), typeof(FakePropertyAttribute), "Value", "OtherValue" ) ); }