示例#1
0
 protected RemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, IRemoteAppDomainTestGeneratorFactory remoteAppDomainTestGeneratorFactory, IOutOfProcessTestGeneratorFactory outOfProcessTestGeneratorFactory, IGeneratorInfoProvider generatorInfoProvider, IIdeTracer tracer, bool enableSettingsCache)
     : base(testGeneratorFactory, tracer, enableSettingsCache)
 {
     _remoteAppDomainTestGeneratorFactory = remoteAppDomainTestGeneratorFactory;
     _outOfProcessTestGeneratorFactory    = outOfProcessTestGeneratorFactory;
     _generatorInfoProvider = generatorInfoProvider;
 }
示例#2
0
        private void Initialize()
        {
            if (generatorFolder == null)
            {
                throw new InvalidOperationException("The RemoteAppDomainTestGeneratorFactory has to be configured with the Setup() method before initialization.");
            }

            AppDomainSetup appDomainSetup = new AppDomainSetup {
                ApplicationBase = generatorFolder
            };

            appDomainSetup.ShadowCopyFiles = "true";
            appDomain = AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;

            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

            var generatorFactoryObject = appDomain.CreateInstanceAndUnwrap(remoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName);

            remoteTestGeneratorFactory = generatorFactoryObject as ITestGeneratorFactory;

            if (remoteTestGeneratorFactory == null)
            {
                throw new InvalidOperationException("Could not load test generator factory.");
            }

            usageCounter = new UsageCounter(LoseReferences);
            tracer.Trace("AppDomain for generator created", "RemoteAppDomainTestGeneratorFactory");
        }
示例#3
0
        private void Cleanup()
        {
            if (!IsRunning)
            {
                return;
            }

            remoteTestGeneratorFactory = null;
            AppDomain.Unload(appDomain);
            appDomain = null;
        }
示例#4
0
        public void Cleanup()
        {
            if (!IsRunning)
            {
                return;
            }

            AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve;
            remoteTestGeneratorFactory = null;
            AppDomain.Unload(appDomain);
            appDomain = null;
            tracer.Trace("AppDomain for generator disposed", "RemoteAppDomainTestGeneratorFactory");
        }
        public void Cleanup()
        {
            if (!IsRunning)
            {
                return;
            }

            System.AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve;
            _tracer.Trace("AssemblyResolve Event removed", LogCategory);
            _remoteAppDomainResolver.Dispose();

            _remoteTestGeneratorFactory = null;
            System.AppDomain.Unload(_appDomain);
            _appDomain = null;
            _tracer.Trace("AppDomain for generator disposed", LogCategory);
        }
示例#6
0
        private void Initialize()
        {
            if (generatorFolder == null)
            {
                throw new InvalidOperationException("The RemoteAppDomainTestGeneratorFactory has to be configured with the Setup() method before initialization.");
            }


            AppDomainSetup appDomainSetup = new AppDomainSetup {
                ApplicationBase = generatorFolder
            };

            appDomainSetup.ShadowCopyFiles = "true";

            //set configuration for generator app domain to have assembly redirects
            var appConfigFile = Path.Combine(generatorFolder, "plugincompability.config");

            if (File.Exists(appConfigFile))
            {
                appDomainSetup.ConfigurationFile = appConfigFile;
            }
            tracer.Trace(string.Format("AppDomainSetup - ApplicationBase: {0}; ConfigFile: {1}", generatorFolder, appDomainSetup.ConfigurationFile ?? "not specified"), LogCategory);

            appDomain = AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;

            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            tracer.Trace(string.Format("TestGeneratorFactory: {0}", testGeneratorFactoryTypeFullName), LogCategory);

            tracer.Trace("AssemblyResolve Event added", LogCategory);
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

            var generatorFactoryObject = appDomain.CreateInstanceAndUnwrap(remoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName);

            remoteTestGeneratorFactory = generatorFactoryObject as ITestGeneratorFactory;

            if (remoteTestGeneratorFactory == null)
            {
                throw new InvalidOperationException("Could not load test generator factory.");
            }

            usageCounter = new UsageCounter(LoseReferences);
            tracer.Trace("AppDomain for generator created", LogCategory);
        }
        private void Initialize()
        {
            if (_info.GeneratorFolder == null)
            {
                throw new InvalidOperationException(
                          "The RemoteAppDomainTestGeneratorFactory has to be configured with the Setup() method before initialization.");
            }


            var appDomainSetup = new AppDomainSetup
            {
                ShadowCopyFiles = "true",
            };

            _appDomain = System.AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;

            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            _tracer.Trace(string.Format("TestGeneratorFactory: {0}", testGeneratorFactoryTypeFullName), LogCategory);

            _tracer.Trace("AssemblyResolve Event added", LogCategory);
            System.AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;


            var remoteAppDomainAssembly = _remoteAppDomainResolverType.Assembly;

            _remoteAppDomainResolver = (RemoteAppDomainResolver)_appDomain.CreateInstanceFromAndUnwrap(remoteAppDomainAssembly.Location, _remoteAppDomainResolverType.FullName, true, BindingFlags.Default, null, null, null, null);
            _remoteAppDomainResolver.Init(_info.GeneratorFolder);

            var generatorFactoryObject = _appDomain.CreateInstanceAndUnwrap(_info.RemoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName);

            _remoteTestGeneratorFactory = generatorFactoryObject as ITestGeneratorFactory;

            if (_remoteTestGeneratorFactory == null)
            {
                throw new InvalidOperationException("Could not load test generator factory.");
            }

            _usageCounter = new UsageCounter(LoseReferences);
            _tracer.Trace("AppDomain for generator created", LogCategory);
        }
示例#8
0
        public void Initialize()
        {
            AppDomainSetup appDomainSetup = new AppDomainSetup {
                ApplicationBase = generatorFolder
            };

            appDomain = AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var remoteGeneratorAssemblyName      = typeof(ITestGeneratorFactory).Assembly.GetName().Name;
            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;

            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            remoteTestGeneratorFactory = appDomain.CreateInstanceAndUnwrap(remoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName) as ITestGeneratorFactory;

            if (remoteTestGeneratorFactory == null)
            {
                throw new InvalidOperationException("Could not load test generator factory.");
            }

            usageCounter = new UsageCounter(Cleanup);
        }
        private void Initialize()
        {
            if (generatorFolder == null)
                throw new InvalidOperationException("The RemoteAppDomainTestGeneratorFactory has to be configured with the Setup() method before initialization.");

            AppDomainSetup appDomainSetup = new AppDomainSetup { ApplicationBase = generatorFolder };
            appDomain = AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;
            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

            var generatorFactoryObject = appDomain.CreateInstanceAndUnwrap(remoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName);
            remoteTestGeneratorFactory = generatorFactoryObject as ITestGeneratorFactory;

            if (remoteTestGeneratorFactory == null)
                throw new InvalidOperationException("Could not load test generator factory.");

            usageCounter = new UsageCounter(Cleanup);
            tracer.Trace("AppDomain for generator created", "RemoteAppDomainTestGeneratorFactory");
        }
示例#10
0
 public BatchGenerator(ITraceListener traceListener, ITestGeneratorFactory testGeneratorFactory)
 {
     this.traceListener        = traceListener;
     this.testGeneratorFactory = testGeneratorFactory;
 }
示例#11
0
 public GeneratorServicesMock(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache, Func <ProjectSettings> getProjectSettings) : base(testGeneratorFactory, new Mock <IIdeTracer>().Object, enableSettingsCache)
 {
     this.getProjectSettings = getProjectSettings;
 }
 protected RemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache) : base(testGeneratorFactory, enableSettingsCache)
 {
 }
示例#13
0
 public BatchGenerator(ITraceListener traceListener, ITestGeneratorFactory testGeneratorFactory)
 {
     this.traceListener = traceListener;
     this.testGeneratorFactory = testGeneratorFactory;
 }
 public RemoteGeneratorServicesMock(ITestGeneratorFactory testGeneratorFactory, IRemoteAppDomainTestGeneratorFactory remoteAppDomainTestGeneratorFactory, Func<GeneratorInfo> getGeneratorInfo)
     : base(testGeneratorFactory, remoteAppDomainTestGeneratorFactory, new Mock<IGeneratorInfoProvider>().Object, new Mock<IIdeTracer>().Object, false)
 {
     this.getGeneratorInfo = getGeneratorInfo;
 }
 protected RemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, IRemoteAppDomainTestGeneratorFactory remoteAppDomainTestGeneratorFactory, IGeneratorInfoProvider generatorInfoProvider, IIdeTracer tracer, bool enableSettingsCache)
     : base(testGeneratorFactory, tracer, enableSettingsCache)
 {
     this.remoteAppDomainTestGeneratorFactory = remoteAppDomainTestGeneratorFactory;
     this.generatorInfoProvider = generatorInfoProvider;
 }
示例#16
0
 protected GeneratorServices(ITestGeneratorFactory testGeneratorFactory, IIdeTracer tracer, bool enableSettingsCache)
 {
     this.testGeneratorFactory = testGeneratorFactory;
     this.tracer = tracer;
     this.enableSettingsCache = enableSettingsCache;
 }
        public void Cleanup()
        {
            if (!IsRunning)
                return;

            AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve;
            remoteTestGeneratorFactory = null;
            AppDomain.Unload(appDomain);
            appDomain = null;
            tracer.Trace("AppDomain for generator disposed", "RemoteAppDomainTestGeneratorFactory");
        }
示例#18
0
 public GeneratorServicesMock(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache, Func<ProjectSettings> getProjectSettings) : base(testGeneratorFactory, new Mock<IIdeTracer>().Object, enableSettingsCache)
 {
     this.getProjectSettings = getProjectSettings;
 }
 protected VsRemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache, Project project, IVisualStudioTracer visualStudioTracer)
     : base(testGeneratorFactory, visualStudioTracer, enableSettingsCache)
 {
     this.project = project;
 }
 public MsBuildBatchGenerator(ITraceListener traceListener, ITestGeneratorFactory testGeneratorFactory, GeneratorTaskBase task) : base(traceListener, testGeneratorFactory)
 {
     this.task = task;
 }
示例#21
0
 protected RemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache) : base(testGeneratorFactory, enableSettingsCache)
 {
 }
 public RemoteGeneratorServicesMock(ITestGeneratorFactory testGeneratorFactory, IRemoteAppDomainTestGeneratorFactory remoteAppDomainTestGeneratorFactory, Func <GeneratorInfo> getGeneratorInfo)
     : base(testGeneratorFactory, remoteAppDomainTestGeneratorFactory, new Mock <IOutOfProcessTestGeneratorFactory>().Object, new Mock <IGeneratorInfoProvider>().Object, new Mock <IIdeTracer>().Object, false)
 {
     this.getGeneratorInfo = getGeneratorInfo;
 }
 protected RemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, IRemoteAppDomainTestGeneratorFactory remoteAppDomainTestGeneratorFactory, IGeneratorInfoProvider generatorInfoProvider, IIdeTracer tracer, bool enableSettingsCache)
     : base(testGeneratorFactory, tracer, enableSettingsCache)
 {
     this.remoteAppDomainTestGeneratorFactory = remoteAppDomainTestGeneratorFactory;
     this.generatorInfoProvider = generatorInfoProvider;
 }
示例#24
0
 protected GeneratorServices(ITestGeneratorFactory testGeneratorFactory, IIdeTracer tracer, bool enableSettingsCache)
 {
     this.testGeneratorFactory = testGeneratorFactory;
     this.tracer = tracer;
     this.enableSettingsCache = enableSettingsCache;
 }
示例#25
0
 protected GeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache)
 {
     this.testGeneratorFactory = testGeneratorFactory;
     this.enableSettingsCache  = enableSettingsCache;
 }
示例#26
0
 protected GeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache)
 {
     this.testGeneratorFactory = testGeneratorFactory;
     this.enableSettingsCache = enableSettingsCache;
 }
示例#27
0
 public MsBuildBatchGenerator(ITraceListener traceListener, ITestGeneratorFactory testGeneratorFactory, GeneratorTaskBase task) : base(traceListener, testGeneratorFactory)
 {
     this.task = task;
 }
        private void Initialize()
        {
            if (generatorFolder == null)
                throw new InvalidOperationException("The RemoteAppDomainTestGeneratorFactory has to be configured with the Setup() method before initialization.");

            AppDomainSetup appDomainSetup = new AppDomainSetup { ApplicationBase = generatorFolder };
            appDomainSetup.ShadowCopyFiles = "true";

            //set configuration for generator app domain to have assembly redirects
            var appConfigFile = Path.Combine(generatorFolder, "plugincompability.config");
            if (File.Exists(appConfigFile))
            {
                appDomainSetup.ConfigurationFile = appConfigFile;
            }

            appDomain = AppDomain.CreateDomain("AppDomainForTestGeneration", null, appDomainSetup);

            var testGeneratorFactoryTypeFullName = typeof(TestGeneratorFactory).FullName;
            Debug.Assert(testGeneratorFactoryTypeFullName != null);

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

            var generatorFactoryObject = appDomain.CreateInstanceAndUnwrap(remoteGeneratorAssemblyName, testGeneratorFactoryTypeFullName);
            remoteTestGeneratorFactory = generatorFactoryObject as ITestGeneratorFactory;

            if (remoteTestGeneratorFactory == null)
                throw new InvalidOperationException("Could not load test generator factory.");

            usageCounter = new UsageCounter(LoseReferences);
            tracer.Trace("AppDomain for generator created", "RemoteAppDomainTestGeneratorFactory");
        }