public void GetCustomAttributesOnTypeShouldReturnAllAttributes() { var tinfo = typeof(ReflectionUtilityTests.DummyBaseTestClass).GetTypeInfo(); var attribs = this.reflectionOperations.GetCustomAttributes(tinfo, false); Assert.IsNotNull(attribs); Assert.AreEqual(1, attribs.Length); var expectedAttribs = new string[] { "DummyA : ba" }; CollectionAssert.AreEqual(expectedAttribs, ReflectionUtilityTests.GetAttributeValuePairs(attribs)); }
public void GetSpecificCustomAttributesOnAssemblyShouldReturnAllAttributes() { var asm = typeof(ReflectionUtilityTests.DummyTestClass).Assembly; var attribs = this.reflectionOperations.GetCustomAttributes(asm, typeof(ReflectionUtilityTests.DummyAAttribute)); Assert.IsNotNull(attribs); Assert.AreEqual(2, attribs.Length); var expectedAttribs = new string[] { "DummyA : a1", "DummyA : a2" }; CollectionAssert.AreEqual(expectedAttribs, ReflectionUtilityTests.GetAttributeValuePairs(attribs)); }
public void GetCustomAttributesShouldReturnAllAttributes() { var minfo = typeof(ReflectionUtilityTests.DummyBaseTestClass).GetMethod("DummyVTestMethod1"); var attribs = this.reflectionOperations.GetCustomAttributes(minfo, false); Assert.IsNotNull(attribs); Assert.AreEqual(2, attribs.Length); var expectedAttribs = new string[] { "DummyA : base", "DummySingleA : base" }; CollectionAssert.AreEqual(expectedAttribs, ReflectionUtilityTests.GetAttributeValuePairs(attribs)); }