Ejemplo n.º 1
0
        public void Linfu()
        {
            var factory = new LinFu.DynamicProxy.ProxyFactory();
            var proxy   = factory.CreateProxy <ItExtendsAnAbstractClass>(new LinfuInterceptor());

            Assert.Equal(-3, proxy.Return(string.Empty));
        }
Ejemplo n.º 2
0
        public IEnumerable<TestResult> Run(RunSettings settings)
        {
            var assembly = getAssembly(settings.Assembly.Assembly);

            var generator = new LinFu.DynamicProxy.ProxyFactory();
            var proxy = new TestListenerProxy(_feedback, settings.Assembly.Assembly);

            _results = new List<TestResult>();
            var mspec = Assembly.LoadFrom("Machine.Specifications.dll");
            var type = mspec.GetType("Machine.Specifications.Runner.Impl.AppDomainRunner");
            var iTestListener = mspec.GetType("Machine.Specifications.Runner.ISpecificationRunListener");
            var dflt = mspec.GetType("Machine.Specifications.Runner.RunOptions").GetProperty("Default").GetValue(null, null);
            var listener = generator.CreateProxy(iTestListener, proxy, new Type[] {});

            var runner = Activator.CreateInstance(type, new object[] {listener, dflt});
            runTests(settings, assembly, runner);
            _results.AddRange(proxy.Results);
            return _results;
        }
Ejemplo n.º 3
0
        public IEnumerable <TestResult> Run(RunSettings settings)
        {
            var assembly = getAssembly(settings.Assembly.Assembly);

            var generator = new LinFu.DynamicProxy.ProxyFactory();
            var proxy     = new TestListenerProxy(_feedback, settings.Assembly.Assembly);

            _results = new List <TestResult>();
            var mspec         = Assembly.LoadFrom("Machine.Specifications.dll");
            var type          = mspec.GetType("Machine.Specifications.Runner.Impl.AppDomainRunner");
            var iTestListener = mspec.GetType("Machine.Specifications.Runner.ISpecificationRunListener");
            var dflt          = mspec.GetType("Machine.Specifications.Runner.RunOptions").GetProperty("Default").GetValue(null, null);
            var listener      = generator.CreateProxy(iTestListener, proxy, new Type[] {});

            var runner = Activator.CreateInstance(type, new object[] { listener, dflt });

            runTests(settings, assembly, runner);
            _results.AddRange(proxy.Results);
            return(_results);
        }