コード例 #1
0
        private void PostProcessTProxiedObject(ProcessedObjectChecker test)
        {
            AppDomain domain = null;

            try
            {
                AppDomainSetup setup = new AppDomainSetup();
                setup.ApplicationBase = Environment.CurrentDirectory;
                domain = AppDomain.CreateDomain("Spring", new Evidence(AppDomain.CurrentDomain.Evidence), setup);
                object foo = domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, typeof(MockContextAwareObject).FullName);

                MockApplicationContext           ctx       = new MockApplicationContext();
                ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
                MockContextAwareObject           afterFoo  = (MockContextAwareObject)processor.PostProcessBeforeInitialization(foo, "MyContextAwareObject");
                test(afterFoo);
            }
            finally
            {
                try
                {
                    AppDomain.Unload(domain);
                }
                catch (Exception ex)
                {
                    Console.Write("Error unloading AppDomain used during testing : " + ex);
                }
            }
        }
コード例 #2
0
		private void PostProcessTProxiedObject(ProcessedObjectChecker test) 
		{
			AppDomain domain = null;
			try
			{
				AppDomainSetup setup = new AppDomainSetup();
				setup.ApplicationBase = Environment.CurrentDirectory;
				domain = AppDomain.CreateDomain("Spring", new Evidence(AppDomain.CurrentDomain.Evidence), setup);
				object foo = domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, typeof(MockContextAwareObject).FullName);
	
				MockApplicationContext ctx = new MockApplicationContext();
				ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
				MockContextAwareObject afterFoo = (MockContextAwareObject) processor.PostProcessBeforeInitialization(foo, "MyContextAwareObject");
				test(afterFoo);
			}
			finally
			{
				try
				{
					AppDomain.Unload(domain);
				}
				catch (Exception ex)
				{
					Console.Write("Error unloading AppDomain used during testing : " + ex);
				}
			}
		}