public void InitializingObjectAndInitMethod()
 {
     InitAndIB.constructed = false;
     IResource resource = new ReadOnlyXmlTestResource("initializers.xml", GetType());
     XmlObjectFactory xof = new XmlObjectFactory(resource);
     Assert.IsFalse(InitAndIB.constructed);
     xof.PreInstantiateSingletons();
     Assert.IsFalse(InitAndIB.constructed);
     InitAndIB iib = (InitAndIB) xof.GetObject("init-and-ib");
     Assert.IsTrue(InitAndIB.constructed);
     Assert.IsTrue(iib.afterPropertiesSetInvoked && iib.initMethodInvoked);
     Assert.IsTrue(!iib.destroyed && !iib.customDestroyed);
     xof.Dispose();
     Assert.IsTrue(iib.destroyed && iib.customDestroyed);
     xof.Dispose();
     Assert.IsTrue(iib.destroyed && iib.customDestroyed);
 }
 public void DefaultDestroyMethodDisabled()
 {
     IResource resource = new ReadOnlyXmlTestResource("default-destroy-methods.xml", GetType());
     XmlObjectFactory xof = new XmlObjectFactory(resource);
     xof.PreInstantiateSingletons();
     DefaultDestroyer dd = (DefaultDestroyer)xof.GetObject("destroy-method2");
     Assert.IsTrue(!dd.customDestroyed);
     xof.Dispose();
     Assert.IsTrue(!dd.customDestroyed);
 }
 public void DependsOn()
 {
     PreparingObject1.prepared = false;
     PreparingObject1.destroyed = false;
     PreparingObject2.prepared = false;
     PreparingObject2.destroyed = false;
     DependingObject.destroyed = false;
     IResource resource = new ReadOnlyXmlTestResource("initializers.xml", GetType());
     XmlObjectFactory xof = new XmlObjectFactory(resource);
     xof.PreInstantiateSingletons();
     xof.Dispose();
     Assert.IsTrue(PreparingObject1.prepared);
     Assert.IsTrue(PreparingObject1.destroyed);
     Assert.IsTrue(PreparingObject2.prepared);
     Assert.IsTrue(PreparingObject2.destroyed);
     Assert.IsTrue(DependingObject.destroyed);
 }