Esempio n. 1
0
        public void MakingOfChildContainerPercolatesLifecycleManager()
        {
            TestLifecycleManager  lifecycleManager = new TestLifecycleManager();
            IMutablePicoContainer parent           = CreatePicoContainer(null, lifecycleManager);

            parent.RegisterComponentImplementation("one", typeof(TestLifecycleComponent));

            IMutablePicoContainer child = parent.MakeChildContainer();

            Assert.IsNotNull(child);
            child.RegisterComponentImplementation("two", typeof(TestLifecycleComponent));

            parent.Start();

            //TODO - The LifecycleManager reference in child containers is not used. Thus is is almost pointless
            // The reason is becuase DefaultPicoContainer's accept() method visits child containerson its own.
            // This may be file for visiting components in a tree for general cases, but for lifecycle, we
            // should hand to each LifecycleManager's start(..) at each appropriate node. See mail-list discussion.

            Assert.AreEqual(2, lifecycleManager.started.Count);
            //assertEquals(1, lifecycleManager.started.size());
        }
        public void MakingOfChildContainerPercolatesLifecycleManager()
        {
            TestLifecycleManager lifecycleManager = new TestLifecycleManager();
            IMutablePicoContainer parent = CreatePicoContainer(null, lifecycleManager);
            parent.RegisterComponentImplementation("one", typeof (TestLifecycleComponent));

            IMutablePicoContainer child = parent.MakeChildContainer();
            Assert.IsNotNull(child);
            child.RegisterComponentImplementation("two", typeof (TestLifecycleComponent));

            parent.Start();

            //TODO - The LifecycleManager reference in child containers is not used. Thus is is almost pointless
            // The reason is becuase DefaultPicoContainer's accept() method visits child containerson its own.
            // This may be file for visiting components in a tree for general cases, but for lifecycle, we
            // should hand to each LifecycleManager's start(..) at each appropriate node. See mail-list discussion.

            Assert.AreEqual(2, lifecycleManager.started.Count);
            //assertEquals(1, lifecycleManager.started.size());
        }