Inheritance: IInvocationHandler
Example #1
0
        public void SetUp()
        {
            // Ensure all classes are loaded and initialized.
            var invocationHandler = new NProxyInvocationHandler(new Standard());
            var proxyFactory      = new ProxyFactory();

            proxyFactory.CreateProxy <IStandard>(Type.EmptyTypes, invocationHandler);
        }
Example #2
0
        public void ProxyInstantiationTest(int iterations)
        {
            var invocationHandler = new NProxyInvocationHandler(new Standard());
            var proxyFactory      = new ProxyFactory();
            var stopwatch         = new Stopwatch();
            var proxyTemplate     = proxyFactory.GetProxyTemplate <IStandard>(Type.EmptyTypes);

            stopwatch.Start();

            for (var i = 0; i < iterations; i++)
            {
                proxyTemplate.CreateProxy(invocationHandler);
            }

            stopwatch.Stop();

            Report.Instance.Write(AssemblyName, Scenario.ProxyInstantiation, iterations, stopwatch.Elapsed);
        }
Example #3
0
        public void MethodInvocationWithGenericParameterTest(int iterations)
        {
            var invocationHandler = new NProxyInvocationHandler(new Generic());
            var proxyFactory      = new ProxyFactory();
            var proxy             = proxyFactory.CreateProxy <IGeneric>(Type.EmptyTypes, invocationHandler);
            var stopwatch         = new Stopwatch();

            stopwatch.Start();

            for (var i = 0; i < iterations; i++)
            {
                proxy.Invoke(i);
            }

            stopwatch.Stop();

            Report.Instance.Write(AssemblyName, Scenario.MethodInvocationWithGenericParameter, iterations, stopwatch.Elapsed);
        }
        public void MethodInvocationWithGenericParameterTest(int iterations)
        {
            var invocationHandler = new NProxyInvocationHandler(new Generic());
            var proxyFactory = new ProxyFactory();
            var proxy = proxyFactory.CreateProxy<IGeneric>(Type.EmptyTypes, invocationHandler);
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            for (var i = 0; i < iterations; i++)
            {
                proxy.Invoke(i);
            }

            stopwatch.Stop();

            Report.Instance.Write(AssemblyName, Scenario.MethodInvocationWithGenericParameter, iterations, stopwatch.Elapsed);
        }
        public void SetUp()
        {
            // Ensure all classes are loaded and initialized.
            var invocationHandler = new NProxyInvocationHandler(new Standard());
            var proxyFactory = new ProxyFactory();

            proxyFactory.CreateProxy<IStandard>(Type.EmptyTypes, invocationHandler);
        }
        public void ProxyInstantiationTest(int iterations)
        {
            var invocationHandler = new NProxyInvocationHandler(new Standard());
            var proxyFactory = new ProxyFactory();
            var stopwatch = new Stopwatch();
            var proxyTemplate = proxyFactory.GetProxyTemplate<IStandard>(Type.EmptyTypes);

            stopwatch.Start();

            for (var i = 0; i < iterations; i++)
            {
                proxyTemplate.CreateProxy(invocationHandler);
            }

            stopwatch.Stop();

            Report.Instance.Write(AssemblyName, Scenario.ProxyInstantiation, iterations, stopwatch.Elapsed);
        }