System.Tests.AttributeIsDefinedTests.IsDefined_PropertyInfo C# (CSharp) Method

IsDefined_PropertyInfo() private method

private IsDefined_PropertyInfo ( ) : void
return void
        public void IsDefined_PropertyInfo()
        {
            PropertyInfo pi = typeof(TestBase).GetProperty("PropBase3");
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute)));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), false));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), true));
            Assert.False(Attribute.IsDefined(pi, typeof(ComVisibleAttribute)));
            Assert.False(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), false));
            Assert.False(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), true));

            pi = typeof(TestBase).GetProperty("PropBase2");
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute)));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), false));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), true));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute)));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), false));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), true));

            pi = typeof(TestSub).GetProperty("PropBase2");
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute)));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), false));
            Assert.True(Attribute.IsDefined(pi, typeof(PropTestAttribute), true));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute)));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), false));
            Assert.True(Attribute.IsDefined(pi, typeof(ComVisibleAttribute), true));
        }