Exemplo n.º 1
0
        public void TestGetComponent6()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(new SingletonComponentEntry(container, typeof(TestClass3)));
            container.Register(new SingletonComponentEntry(container, typeof(TestClass4)));
            container.GetComponent(typeof(TestClass3));
        }
Exemplo n.º 2
0
        public void TestGetComponent5()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(typeof(TestClass3));
            container.Register(typeof(TestClass4));
            container.GetComponent(typeof(TestClass3));
        }
Exemplo n.º 3
0
        public void TestGetComponent11()
        {
            IMutableComponentContainer parent = new ComponentContainerImpl();
            IMutableComponentContainer child  = new ComponentContainerImpl();

            parent.AddChild(child);
            child.Register(typeof(TestClass1));
            parent.Register(typeof(TestClass2));
            parent.Register(typeof(TestClass3));
            parent.GetComponent(typeof(TestClass3));
        }
Exemplo n.º 4
0
        public void TestGetComponent12()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(typeof(TestClass1), "TestClass1");
            container.Register(typeof(TestClass5));

            Console.WriteLine("Test12 Start");
            TestClass5 test = (TestClass5)container.GetComponent(typeof(TestClass5));

            test.Print();
            Console.WriteLine("Test12 End");
        }
Exemplo n.º 5
0
        public void TestGetComponent8()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(typeof(TestClass1), "TestComponent");
            try
            {
                Console.WriteLine("Test8 Start");
                TestClass1 test = (TestClass1)container.GetComponent("TestComponent");
                test.Print();
                Console.WriteLine("Test8 End");
            }
            catch
            {
                Assert.Fail();
            }
        }
Exemplo n.º 6
0
        public void TestGetComponent15()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(typeof(TestClass1));
            container.Register(typeof(TestClass6));
            try
            {
                Console.WriteLine("Test14 Start");
                TestClass6 test = (TestClass6)container.GetComponent(typeof(TestClass6));
                test.Print();
                Console.WriteLine("Test14 End");
            }
            catch (Exception e)
            {
                Assert.Fail(e.StackTrace);
            }
        }
Exemplo n.º 7
0
        public void TestGetComponent10()
        {
            IMutableComponentContainer parent = new ComponentContainerImpl();
            IMutableComponentContainer child  = new ComponentContainerImpl();

            parent.AddChild(child);
            child.Register(typeof(TestClass1), "Test1");
            try
            {
                Console.WriteLine("Test10 Start");
                TestClass1 test = (TestClass1)parent.GetComponent("Test1");
                test.Print();
                Console.WriteLine("Test10 End");
            }
            catch
            {
                Assert.Fail();
            }
        }