Exemple #1
0
 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);
        }
Exemple #3
0
        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());
            }
        }