Пример #1
0
        public void ValidateUsageWithContainerType_ContainerTypeWithTwoPropertiesWithArgumentsAttribute_ThrowsInvalidOperationException()
        {
            Type containerType = typeof(ContainerWithTwoArgumentsAttributeProperties);
            var  attr          = new ArgumentsAttribute();

            Assert.Throws <InvalidOperationException>(() => attr.ValidateUsage(containerType));
        }
Пример #2
0
        public void ValidateUsageWithContainerType_ContainerTypeWithOnePropertyWithArgumentsAttribute_ValidatesOK()
        {
            Type containerType = typeof(ContainerWithOneArgumentsAttributeProperty);
            var  attr          = new ArgumentsAttribute();

            attr.ValidateUsage(containerType);
        }
Пример #3
0
        public void ValidateUsageWithPropertyInfo_PropertyWithArgumentsAttributeOnStringCollectionProperty_ValidatesOK()
        {
            PropertyInfo property = typeof(ContainerWithStringCollectionArgumentsProperty).GetProperty("Arguments");
            var          attr     = new ArgumentsAttribute();

            attr.ValidateUsage(property);
        }
Пример #4
0
        public void ValidateUsageWithPropertyInfo_PropertyWithoutArgumentsAttribute_ThrowsInvalidOperationException()
        {
            PropertyInfo property = typeof(ContainerWithPropertyWithoutArgumentsAttribute).GetProperty("Arguments1");
            var          attr     = new ArgumentsAttribute();

            Assert.Throws <InvalidOperationException>(() => attr.ValidateUsage(property));
        }
Пример #5
0
        public void ValidateUsageWithPropertyInfo_PropertyWithArgumentsAttributeButNotACollection_ThrowsInvalidOperationException()
        {
            PropertyInfo property = typeof(ContainerWithNonCollectionArgumentsProperty).GetProperty("Arguments");
            var          attr     = new ArgumentsAttribute();

            Assert.Throws <InvalidOperationException>(() => attr.ValidateUsage(property));
        }