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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
 public void ValidateProperty_ProtectedProperty_Success()
 {
     // Arrange & Act & Assert
     AttributeAssert.ValidateProperty(
         typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)),
         typeof(FakePropertyAttribute),
         "ProtectedValue",
         "TestProtectedValue"
         );
 }
Ejemplo n.º 8
0
 public void ValidateProperty_ThrowsNotNullExceptionIfNoAttribute()
 {
     // Arrange & Act & Assert
     Assert.Throws <NotNullException>(
         () => AttributeAssert.ValidateProperty(
             typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)),
             typeof(FakeClassAttribute),
             "NoSuchProperty",
             "TestValue"
             )
         );
 }
Ejemplo n.º 9
0
 public void ValidateProperty_ThrowsEqualExceptionIfAttributePropertyValueNotEqual()
 {
     // Arrange & Act & Assert
     Assert.Throws <EqualException>(
         () => AttributeAssert.ValidateProperty(
             typeof(FakeClassModel).GetProperty(nameof(FakeClassModel.Value)),
             typeof(FakePropertyAttribute),
             "Value",
             "OtherValue"
             )
         );
 }