Exemplo n.º 1
0
        protected override ITestGeneratorFactory GetTestGeneratorFactoryForCreate()
        {
            // if we already have a generator factory -> use it!
            if (remoteAppDomainTestGeneratorFactory != null)
                return remoteAppDomainTestGeneratorFactory;

            GeneratorInfo generatorInfo = GetGeneratorInfo();
            if (generatorInfo == null || generatorInfo.GeneratorAssemblyVersion == null || generatorInfo.GeneratorFolder == null)
            {
                // we don't know about the generator -> call the "current" directly
                return base.GetTestGeneratorFactoryForCreate();
            }

            if (generatorInfo.GeneratorAssemblyVersion == GetCurrentGeneratorAssemblyVersion())
            {
                // uses the "current" generator -> call it directly
                return base.GetTestGeneratorFactoryForCreate();
            }

            try
            {
                remoteAppDomainTestGeneratorFactory = new RemoteAppDomainTestGeneratorFactory(generatorInfo.GeneratorFolder);
                remoteAppDomainTestGeneratorFactory.Initialize();
                return remoteAppDomainTestGeneratorFactory;
            }
            catch(Exception exception)
            {
                Debug.WriteLine(exception, "RemoteGeneratorServices.GetTestGeneratorFactoryForCreate");
                // there was an error -> call the "current" directly (plus cleanup)
                Cleanup();
                return base.GetTestGeneratorFactoryForCreate();
            }
        }
Exemplo n.º 2
0
 private void Cleanup()
 {
     if (remoteAppDomainTestGeneratorFactory != null)
     {
         remoteAppDomainTestGeneratorFactory.Dispose();
         remoteAppDomainTestGeneratorFactory = null;
     }
 }
Exemplo n.º 3
0
 private void Cleanup()
 {
     if (remoteAppDomainTestGeneratorFactory != null)
     {
         remoteAppDomainTestGeneratorFactory.Dispose();
         remoteAppDomainTestGeneratorFactory = null;
     }
 }
Exemplo n.º 4
0
        protected override ITestGeneratorFactory GetTestGeneratorFactoryForCreate()
        {
            // if we already have a generator factory -> use it!
            if (remoteAppDomainTestGeneratorFactory != null)
            {
                return(remoteAppDomainTestGeneratorFactory);
            }

            GeneratorInfo generatorInfo = GetGeneratorInfo();

            if (generatorInfo == null || generatorInfo.GeneratorAssemblyVersion == null || generatorInfo.GeneratorFolder == null)
            {
                // we don't know about the generator -> call the "current" directly
                return(base.GetTestGeneratorFactoryForCreate());
            }

            if (generatorInfo.GeneratorAssemblyVersion == GetCurrentGeneratorAssemblyVersion())
            {
                // uses the "current" generator -> call it directly
                return(base.GetTestGeneratorFactoryForCreate());
            }

            try
            {
                remoteAppDomainTestGeneratorFactory = new RemoteAppDomainTestGeneratorFactory(generatorInfo.GeneratorFolder);
                remoteAppDomainTestGeneratorFactory.Initialize();
                return(remoteAppDomainTestGeneratorFactory);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception, "RemoteGeneratorServices.GetTestGeneratorFactoryForCreate");
                // there was an error -> call the "current" directly (plus cleanup)
                Cleanup();
                return(base.GetTestGeneratorFactoryForCreate());
            }
        }
 private RemoteAppDomainTestGeneratorFactory CreateRemoteAppDomainTestGeneratorFactory(string generatorFolder)
 {
     var factory = new RemoteAppDomainTestGeneratorFactory(tracerStub.Object);
     factory.Setup(generatorFolder);
     return factory;
 }