public void GetCustomAttributes4() { var c = new CustomAttributesTest(); var x = c.GetType().GetProperty("P4").GetCustomAttributes <CustomAttributeAttribute>(false); Assert.Equal(2, x.Length); }
public void GetCustomAttributes3() { var c = new CustomAttributesTest(); var x = c.GetType().GetProperty("P3").GetCustomAttributes <CustomAttributeAttribute>(false); Assert.Equal(1, x.Length); Assert.Equal("Foo", x.ElementAt(0).Name); }
public void GetMemberTypeTest1() { var c = new CustomAttributesTest(); Assert.Equal(typeof(string), c.GetType().GetProperty("P1").GetMemberType()); Assert.Equal(typeof(int), c.GetType().GetProperty("P5").GetMemberType()); Assert.Equal(typeof(CustomAttributesTest), c.GetType().GetProperty("P6").GetMemberType()); Assert.Equal(typeof(string), c.GetType().GetField("M1").GetMemberType()); }
public void GetMemberTypeTest2() { var c = new CustomAttributesTest(); Assert.Throws(typeof(NotSupportedException), () => c.GetType().GetMemberType()); }
public void GetCustomAttributes2() { var c = new CustomAttributesTest(); Assert.Equal(1, c.GetType().GetProperty("P2").GetCustomAttributes <CustomAttributeAttribute>(false).Length); }
public void GetCustomAttribute2() { var c = new CustomAttributesTest(); Assert.NotNull(c.GetType().GetProperty("P2").GetCustomAttribute <CustomAttributeAttribute>(false)); }