public void After_adding_attribute_must_be_listed_as_contained()
        {
            AttributesToAvoidReplicating.Add <string>();
            bool contains = AttributesToAvoidReplicating.Contains(typeof(string));

            Assert.IsTrue(contains);
        }
        public void After_adding_attribute_must_still_contain_original_attributes()
        {
            AttributesToAvoidReplicating.Add <string>();
            bool contains = AttributesToAvoidReplicating.Contains(typeof(System.Runtime.InteropServices.ComImportAttribute));

            Assert.IsTrue(contains);
        }
Пример #3
0
        private static T CreateServiceImpl(IInterceptor interceptor)
        {
            var serviceNamer = new ProxyNamer(new NamingScope(), typeof(T));
            var generator    = new ProxyGenerator(new DefaultProxyBuilder(new ModuleScope(false, false, serviceNamer, ModuleScope.DEFAULT_ASSEMBLY_NAME, ModuleScope.DEFAULT_FILE_NAME, ModuleScope.DEFAULT_ASSEMBLY_NAME, ModuleScope.DEFAULT_FILE_NAME)));

            AttributesToAvoidReplicating.Add <ServiceContractAttribute>();
            AttributesToAvoidReplicating.Add <OperationContractAttribute>();

            object proxy = generator.CreateInterfaceProxyWithoutTarget <T>(interceptor);

            return((T)proxy);
        }
Пример #4
0
        public BaseTest()
        {
            AttributesToAvoidReplicating.Add <TypeIdentifierAttribute>();
            chirp = new Chirp();

            app = GetApp();

            Array arr = null;

            chirp.OnConnection(app, ext_ConnectMode.ext_cm_AfterStartup, QuickMock <AddIn>(), ref arr);
            tasks = new TaskList(app);
        }
Пример #5
0
        public static void AssemblyInit(TestContext context)
        {
            // Moq 4.0 Beta 3 (or rather the version of Castle DynamicProxy its using) has problems with some CAS attributes:
            // http://code.google.com/p/moq/issues/detail?id=250
            // This should be fixed in the next version of Moq and this Assembly init code should not be needed.
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();

            // Initialize the Url Rewriter status cache to indicate that Url Rewriter is present
            HttpContextBase httpContext = PathHelpersTest.GetMockHttpContext(includeRewriterServerVar: false).Object;

            PathHelpers.GenerateClientUrl(httpContext, "index.html");
        }
        private static void ConfigureDynamicProxyToAvoidReplicatingProblematicAttributes()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
#pragma warning restore 618
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
#if (NET4 || NET45)
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();
#endif
            AttributesToAvoidReplicating.Add <UIPermissionAttribute>();
        }
Пример #7
0
        static CastleProxyFactory()
        {
                        #if FEATURE_CAS
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <UIPermissionAttribute>();
                        #endif

                        #if FEATURE_COM
            AttributesToAvoidReplicating.Add <MarshalAsAttribute>();
            AttributesToAvoidReplicating.Add <TypeIdentifierAttribute>();
                        #endif
        }
        static CastleProxyFactory()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
#pragma warning restore 618

#if !SILVERLIGHT
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
#if !NET3x
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();
#endif
#endif
        }
Пример #9
0
        static DynamicAvatarFactory()
        {
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();

            options = new ProxyGenerationOptions {
                Hook = new ObjectMethodsHook()
            };
#if DEBUG
            // This allows invoking generator.ProxyBuilder.ModuleScope.SaveAssembly() for troubleshooting.
            generator = new ProxyGenerator(new DefaultProxyBuilder(new ModuleScope(true)));
#else
            generator = new ProxyGenerator();
#endif
        }
Пример #10
0
        static DynamicProxyFactory()
        {
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();

            proxyOptions = new ProxyGenerationOptions {
                Hook = new ProxyMethodHook()
            };
            generator = new ProxyGenerator();

#if DEBUG
            // generator = new ProxyGenerator(new DefaultProxyBuilder(new ModuleScope(true)));
#else
            // generator = new ProxyGenerator();
#endif
        }
Пример #11
0
        private static void ConfigureDynamicProxyToAvoidReplicatingProblematicAttributes()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
#pragma warning restore 618

            AttributesToAvoidReplicating.Add <System.ServiceModel.ServiceContractAttribute>();

#if !SILVERLIGHT
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
#if NET4
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();
#endif
#endif
        }
Пример #12
0
        static ProxyFactory()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute> ();
#pragma warning restore 618

            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute> ();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute> ();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute> ();
            AttributesToAvoidReplicating.Add <UIPermissionAttribute> ();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute> ();

            proxyOptions = new ProxyGenerationOptions {
                Hook = new ProxyMethodHook()
            };
            generator = new ProxyGenerator();
        }
Пример #13
0
        static CastleProxyFactory()
        {
#if FEATURE_CAS
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <UIPermissionAttribute>();
#endif

#if FEATURE_COM
            AttributesToAvoidReplicating.Add <MarshalAsAttribute>();
            AttributesToAvoidReplicating.Add <TypeIdentifierAttribute>();
#endif

            proxyOptions = new ProxyGenerationOptions {
                Hook = new IncludeObjectMethodsHook()
            };
        }
Пример #14
0
        static CastleProxyFactory()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add <SecurityPermissionAttribute>();
#pragma warning restore 618

#if !SILVERLIGHT
            AttributesToAvoidReplicating.Add <ReflectionPermissionAttribute>();
            AttributesToAvoidReplicating.Add <PermissionSetAttribute>();
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.MarshalAsAttribute>();
            AttributesToAvoidReplicating.Add <UIPermissionAttribute>();
#if !NET3x
            AttributesToAvoidReplicating.Add <System.Runtime.InteropServices.TypeIdentifierAttribute>();
#endif
#endif
            proxyOptions = new ProxyGenerationOptions {
                Hook = new ProxyMethodHook(), BaseTypeForInterfaceProxy = typeof(InterfaceProxy)
            };
        }
Пример #15
0
 public static void Initialize(TestContext context)
 {
     AttributesToAvoidReplicating.Add(typeof(ServiceContractAttribute));
 }
Пример #16
0
 static CastleDynamicProxyGenerator()
 {
     AttributesToAvoidReplicating.Add(typeof(SecurityPermissionAttribute));
 }
 protected ServiceAttributeBase()
 {
     IsInitialized.GetOrAdd(GetType(), t => {
         AttributesToAvoidReplicating.Add(t);
         return(default);
     });
Пример #18
0
        static CastleDynamicProxyGenerator()
        {
#pragma warning disable 618
            AttributesToAvoidReplicating.Add(typeof(SecurityPermissionAttribute));
#pragma warning restore 618
        }
Пример #19
0
 public void MyTestInitialize()
 {
     AttributesToAvoidReplicating.Add(typeof(UIPermissionAttribute));
 }