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);
                }
            }
        }
		public void DoNotAttachContextForRegularObject()
		{
			MockApplicationContext ctx = new MockApplicationContext();
			ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
			object obj = new object();
			object obj1 = processor.PostProcessBeforeInitialization(obj, "MyContextAwareObject");
			Assert.AreEqual(obj, obj1, "Objects don't equal");
		}
        public void DoNotAttachContextForRegularObject()
        {
            MockApplicationContext           ctx       = new MockApplicationContext();
            ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
            object obj  = new object();
            object obj1 = processor.PostProcessBeforeInitialization(obj, "MyContextAwareObject");

            Assert.AreEqual(obj, obj1, "Objects don't equal");
        }
		public void AttachContext()
		{
			MockApplicationContext ctx = new MockApplicationContext();
			ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
			MockContextAwareObject obj = new MockContextAwareObject();
			Assert.IsNull(obj.GetApplicationContext(), "Context Does Not Equal");
			MockContextAwareObject obj2 = (MockContextAwareObject) processor.PostProcessBeforeInitialization(obj, "MyContextAwareObject");
			Assert.AreEqual(ctx, obj2.GetApplicationContext(), "Context Does Not Equal");
		}
        public void AttachContext()
        {
            MockApplicationContext           ctx       = new MockApplicationContext();
            ApplicationContextAwareProcessor processor = new ApplicationContextAwareProcessor(ctx);
            MockContextAwareObject           obj       = new MockContextAwareObject();

            Assert.IsNull(obj.GetApplicationContext(), "Context Does Not Equal");
            MockContextAwareObject obj2 = (MockContextAwareObject)processor.PostProcessBeforeInitialization(obj, "MyContextAwareObject");

            Assert.AreEqual(ctx, obj2.GetApplicationContext(), "Context Does Not Equal");
        }
		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);
				}
			}
		}