Example #1
0
        public void TestChildGetsFromParent()
        {
            parent.RegisterComponentImplementation(typeof(SimpleTouchable));
            child.RegisterComponentImplementation(typeof(DependsOnTouchable));
            DependsOnTouchable dependsOnTouchable =
                (DependsOnTouchable)child.GetComponentInstance(typeof(DependsOnTouchable));

            Assert.IsNotNull(dependsOnTouchable);
        }
Example #2
0
        public void ParentComponentRegisteredAsClassShouldBePreffered()
        {
            DefaultPicoContainer parent = new DefaultPicoContainer();
            DefaultPicoContainer child  = new DefaultPicoContainer(parent);

            parent.RegisterComponentImplementation(typeof(ITouchable), typeof(AlternativeTouchable));
            child.RegisterComponentImplementation("key", typeof(SimpleTouchable));
            child.RegisterComponentImplementation(typeof(DependsOnTouchable));

            DependsOnTouchable dot = (DependsOnTouchable)child.GetComponentInstanceOfType(typeof(DependsOnTouchable));

            Assert.AreEqual(typeof(AlternativeTouchable), dot.getTouchable().GetType());
        }
        public DependsOnTwoComponents(ITouchable Touchable, DependsOnTouchable fred)
        {
            //    Assert.IsNotNull("Touchable cannot be passed in as null", Touchable);
//      Assert.IsNotNull("DependsOnTouchable cannot be passed in as null", fred);
        }