コード例 #1
0
        public void CtorTest()
        {
            var a = new TypeForwardedToAttribute(typeof(Math));

            Assert.AreEqual(typeof(Math), a.Destination);

            a = new TypeForwardedToAttribute(null);
            Assert.AreEqual(null, a.Destination);
        }
コード例 #2
0
        public static void TypeForwardedToAttributeTests()
        {
            var attr1 = new TypeForwardedToAttribute(null);

            Assert.Null(attr1.Destination);

            var attr2 = new TypeForwardedToAttribute(typeof(AttributesTests));

            Assert.Equal(typeof(AttributesTests), attr2.Destination);
        }
コード例 #3
0
 private void Init(TypeForwardedToAttribute forwardedTo)
 {
     this.m_ctor = typeof(TypeForwardedToAttribute).GetConstructor(BindingFlags.Instance | BindingFlags.Public, (Binder)null, new Type[1] {
         typeof(Type)
     }, (ParameterModifier[])null);
     this.m_typedCtorArgs = (IList <CustomAttributeTypedArgument>)Array.AsReadOnly <CustomAttributeTypedArgument>(new CustomAttributeTypedArgument[1]
     {
         new CustomAttributeTypedArgument(typeof(Type), (object)forwardedTo.Destination)
     });
     this.m_namedArgs = (IList <CustomAttributeNamedArgument>)Array.AsReadOnly <CustomAttributeNamedArgument>(new CustomAttributeNamedArgument[0]);
 }
コード例 #4
0
        private void Init(TypeForwardedToAttribute forwardedTo)
        {
            Type type = typeof(TypeForwardedToAttribute);

            Type[] types = new Type[] { typeof(Type) };
            this.m_ctor = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, types, null);
            CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument(typeof(Type), forwardedTo.Destination) };
            this.m_typedCtorArgs = Array.AsReadOnly <CustomAttributeTypedArgument>(array);
            CustomAttributeNamedArgument[] argumentArray2 = new CustomAttributeNamedArgument[0];
            this.m_namedArgs = Array.AsReadOnly <CustomAttributeNamedArgument>(argumentArray2);
        }