public virtual void TearDown()
 {
     try
     {
         _appDomain.DoCallBack(() =>
         {
             if (_application != null)
             {
                 _application.Passivate();
             }
             _model             = null;
             _structureServices = null;
         });
     }
     finally
     {
         _appDomain.Dispose();
         _appDomain = null;
     }
 }
 public virtual void SetUp()
 {
     _appDomain = Qi4CSTestUtils.CreateTestAppDomain("Qi4CS Instance Test");
     _appDomain.DoCallBack(() =>
     {
         ArchitectureType architecture = this.CreateArchitecture();
         this.SetUpArchitecture(architecture);
         var ass = ReflectionHelper.QI4CS_ASSEMBLY;
         _model  = this.CreateModel(architecture);
         _model.GenerateAndSaveAssemblies(emittingInfoCreator: Qi4CSCodeGenHelper.EmittingArgumentsCallback);
         _application       = _model.NewInstance(TestConstants.APPLICATION_NAME, TestConstants.APPLICATION_MODE, TestConstants.APPLICATION_VERSION);
         _structureServices = this.GetStructureProvider(_application);
         _application.Activate();
     });
 }