static GenericTypeConvertersTest() { TestAppDomain.ensureClassesLoaded( typeof(GenericTypeConvertersTest_CA), typeof(GenericTypeConvertersTest_CB), typeof(GenericTypeConvertersTest_CC), typeof(GenericTypeConvertersTest_CD) ); }
private void CreateTestAppDomain() { AppDomainSetup domainSetup = new AppDomainSetup() { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, }; TestAppDomain = AppDomain.CreateDomain(TestDomainName, null, domainSetup); TestAppDomain.SetData(AppDomainDataKey, this); TestAppDomain.AssemblyResolve += OnAssemblyResolve; RemoteObject = (T)TestAppDomain.CreateInstanceAndUnwrap(typeof(T).Assembly.FullName, typeof(T).FullName); }
internal static void ExecuteTestInsideTestAppDomain(Action <TestSetup> action) { IsolatedStorageWrapper isolatedStorageWrapper = null; TestAppDomain testAppDomain = null; try { isolatedStorageWrapper = new IsolatedStorageWrapper(IsolatedStorageFile.GetUserStoreForAssembly()); GivenAnEmbeddedAssemblyLoader.CopyExecutingAssemblyTo(isolatedStorageWrapper.StorageDirectory); testAppDomain = new TestAppDomain(isolatedStorageWrapper.StorageDirectory); action(new TestSetup(AppDomain.CurrentDomain, testAppDomain.AppDomain)); } finally { ActOnObject.IfNotNull(testAppDomain, (tad) => tad.Unload()); ActOnObject.IfNotNull(isolatedStorageWrapper, (sw) => sw.Remove()); } }