public void GetAttribute_Inherit_Method_IndexSetButOfOufRange()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetMethod(nameof(ChildPoco.MyMethodWithMultipleAttributes));

            // Act
            CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider, index: 99);
        }
        public void GetAttribute_NoMatchingTypes_Property()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetProperty(nameof(ChildPoco.MyStringWithMultipleAttributes));

            // Act
            CustomAttributeProviderExtensions.GetAttribute <OtherAttribute>(provider);
        }
        public void HasAttribute_False_Property_InheritenceNotOnProperties()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetProperty(nameof(ChildPoco.MyStringWithAttribute));

            // Act
            var actual = CustomAttributeProviderExtensions.HasAttribute <SimpleAttribute>(provider);

            // Assert
            actual.ShouldHaveSameValueAs(false);
        }
        public void GetAttribute_Property()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetProperty(nameof(ChildPoco.MyStringWithMultipleAttributes));
            var expected = new ChildAttribute();

            // Act
            var actual = CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
        public void GetAttributes_Inherit_Method()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetMethod(nameof(ChildPoco.MyMethod));
            var expected = new SimpleAttribute[] { new ChildAttribute() };

            // Act
            var actual = CustomAttributeProviderExtensions.GetAttributes <SimpleAttribute>(provider);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
        public void GetAttribute_Inherit_Method_IndexSet()
        {
            // Arrange
            var provider = typeof(ChildPoco).GetMethod(nameof(ChildPoco.MyMethodWithMultipleAttributes));
            var expected = new ChildAttribute()
            {
                MyValue = 1
            };

            // Act
            var actual = CustomAttributeProviderExtensions.GetAttribute <SimpleAttribute>(provider, index: 1);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
 public void HasAttribute_InstanceNull()
 {
     // Act
     CustomAttributeProviderExtensions.HasAttribute <Attribute>(null);
 }
 public void GetAttribute_InstanceNull_Property()
 {
     // Act
     CustomAttributeProviderExtensions.GetAttribute <Attribute>(null);
 }