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 Value_XmlElementAttribute_Defined()
        {
            // Arrange & Act & Assert
            var propertyInfo = TypeAssert.PropertyHasAttribute <Resx.DataNode>("Value", typeof(XmlElementAttribute));

            AttributeAssert.ValidateProperty(propertyInfo, typeof(XmlElementAttribute), nameof(XmlElementAttribute.ElementName), "value");
        }
示例#3
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 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 PropertyHasAttributeGeneric_Success()
        {
            // Arrange & Act & Assert
            var attribute = TypeAssert.PropertyHasAttribute <FakeClassModel, FakePropertyAttribute>(nameof(FakeClassModel.Value));

            Assert.NotNull(attribute);
            Assert.IsAssignableFrom <FakePropertyAttribute>(attribute);
        }
        public void PropertyHasAttribute_Success()
        {
            // Arrange & Act & Assert
            var propertyInfo = TypeAssert.PropertyHasAttribute <FakeClassModel>(nameof(FakeClassModel.Value), typeof(FakePropertyAttribute));

            Assert.NotNull(propertyInfo);
            Assert.IsAssignableFrom <PropertyInfo>(propertyInfo);
        }
示例#7
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);
            }
        }
 public void PropertyHasAttribute_ThrowsTrueExceptionIfNoAttribute()
 {
     // Arrange & Act & Assert
     Assert.Throws <TrueException>(
         () => TypeAssert.PropertyHasAttribute <FakeClassModel>(
             nameof(FakeClassModel.Value),
             typeof(FakeClassAttribute)
             )
         );
 }
 public void PropertyHasAttribute_ThrowsNotNullExceptionIfNoProperty()
 {
     // Arrange & Act & Assert
     Assert.Throws <NotNullException>(
         () => TypeAssert.PropertyHasAttribute <FakeClassModel>(
             "NoSuchProperty",
             typeof(FakePropertyAttribute)
             )
         );
 }