示例#1
0
        public void TestGetComponent2()
        {
            IMutableComponentContainer container = new ComponentContainerImpl();

            container.Register(typeof(TestClass1));
            container.Register(typeof(TestClass3));
            try
            {
                Console.WriteLine("Test2 Start");
                TestClass3 test = (TestClass3)container.GetComponent(typeof(TestClass3));
                test.Print();
                Console.WriteLine("Test2 End");
            }
            catch (Exception e)
            {
                Assert.Fail(e.StackTrace);
            }
        }
示例#2
0
        public void TestGetComponent13()
        {
            AutoComponentContainerBuilder builder = new AutoComponentContainerBuilder();

            builder.ComponentCategory = "Test";
            builder.AddAssemblyFile(Assembly.GetExecutingAssembly().Location);
            IComponentContainer container = builder.Build();

            try
            {
                Console.WriteLine("Test13 Start");
                TestClass3 test = (TestClass3)container.GetComponent(typeof(TestClass3));
                test.Print();
                Console.WriteLine("Test13 End");
            }
            catch (Exception e)
            {
                Assert.Fail(e.StackTrace);
            }
        }