public void IsDefined()
        {
            ConstructorBuilder cb = genClass.DefineConstructor(
                0, 0,
                new Type [1] {
                typeof(int)
            });

            cb.GetILGenerator().Emit(OpCodes.Ret);

            try {
                cb.IsDefined(null, true);
                Assert.Fail("#A1");
            } catch (NotSupportedException ex) {
                // The invoked member is not supported in a dynamic
                // module
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#A2");
                Assert.IsNull(ex.InnerException, "#A3");
                Assert.IsNotNull(ex.Message, "#A4");
            }

            genClass.CreateType();

            try {
                cb.IsDefined(null, true);
                Assert.Fail("#B1");
            } catch (NotSupportedException ex) {
                // The invoked member is not supported in a dynamic
                // module
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#B2");
                Assert.IsNull(ex.InnerException, "#B3");
                Assert.IsNotNull(ex.Message, "#B4");
            }
        }
        public void IsDefined_ThrowsNotSupportedException()
        {
            TypeBuilder        type        = Helpers.DynamicType(TypeAttributes.Public);
            ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[0]);

            Assert.Throws <NotSupportedException>(() => constructor.IsDefined(typeof(IntAllAttribute)));
        }