예제 #1
0
        public void EnsureProxyHasAttributesOnProperties()
        {
            AttributedClass proxy        = generator.CreateClassProxy <AttributedClass>();
            PropertyInfo    nameProperty = proxy.GetType().GetProperty("Name");

            Assert.IsTrue(nameProperty.IsDefined(typeof(NonInheritableAttribute), false));
        }
            public void Method()
            {
                var x = new AttributedClass();

#pragma warning disable 612,618
                x.Method();
#pragma warning restore 612,618
            }
예제 #3
0
        public void EnsureProxyHasAttributesOnClassAndMethods()
        {
            AttributedClass instance = (AttributedClass)
                                       generator.CreateClassProxy(typeof(AttributedClass), new StandardInterceptor());

            object[] attributes = instance.GetType().GetCustomAttributes(typeof(NonInheritableAttribute), false);
            Assert.AreEqual(1, attributes.Length);
            Assert.IsInstanceOf(typeof(NonInheritableAttribute), attributes[0]);

            attributes = instance.GetType().GetMethod("Do1").GetCustomAttributes(typeof(NonInheritableAttribute), false);
            Assert.AreEqual(1, attributes.Length);
            Assert.IsInstanceOf(typeof(NonInheritableAttribute), attributes[0]);
        }
예제 #4
0
            internal static object CreateObject(CreationHints hints)
            {
                object _return = null;

                switch (hints)
                {
                case CreationHints.Suxuxe12:
                    _return = new AttributedClass();
                    break;

                case CreationHints.Gipoci82:
                    _return = new Siyova16();
                    break;
                }
                return(_return);
            }
예제 #5
0
        public void ObsoleteTest()
        {
            object _unknownObject = AttributedClass.GetObject();

            Assert.IsNotNull(_unknownObject);
        }
 public static void Main()
 {
     AttributedMethod();
     var _  = new AttributedClass();
     var _2 = new UsedCorelibType();
 }
 public static void Main()
 {
     AttributedMethod();
     var _ = new AttributedClass();
 }
 public void Method()
 {
     var x = new AttributedClass();
     #pragma warning disable 612,618
     x.Method();
     #pragma warning restore 612,618
 }