コード例 #1
0
        private ISuiteResult RunAssemblySuites(
            Assembly assembly,
            [CanBeNull] string cachePath,
            ICancellationTokenSource cancellationTokenSource,
            IIntent assemblyIntent)
        {
            using (var appDomain = _appDomainFactory.Create(assembly, cachePath))
            {
                var cancellation          = appDomain.CreateProxy <ICancellation>(typeof(CrossAppDomainCancellation));
                var assemblyRunnerFactory = appDomain.CreateProxy <IAssemblyRunnerFactory>(typeof(AssemblyRunnerFactory));

                var assemblyRunner = assemblyRunnerFactory.Create(_listener, _resourceManager, cancellation);
                cancellationTokenSource.Token.Register(cancellation.Cancel);

                return(assemblyRunner.Run(assemblyIntent));
            }
        }
コード例 #2
0
        public virtual void before_each()
        {
            autoSubstitute = new AutoSubstitute();

            targetDomain     = autoSubstitute.Resolve <ITargetAppDomain>();
            appDomainFactory = autoSubstitute.Resolve <IAppDomainFactory>();
            appDomainFactory.Create(somePath).Returns(targetDomain);

            proxyable        = autoSubstitute.Resolve <IDummyProxyable>();
            proxyableFactory = autoSubstitute.Resolve <IProxyableFactory <IDummyProxyable> >();
            proxyableFactory.CreateProxy(targetDomain).Returns(proxyable);

            runner = new CrossDomainRunner <IDummyProxyable, float>(appDomainFactory, proxyableFactory);

            proxyable.PassInput(Arg.Any <float>()).Returns(callInfo =>
            {
                float input = callInfo.Arg <float>();
                return(input);
            });
        }