コード例 #1
0
 public Test4(Test1 test1, Test test, Test2 test2, Test3 test3)
 {
     this.Test1 = test1;
     this.Test  = test;
     this.Test2 = test2;
     this.Test3 = test3;
 }
コード例 #2
0
        public void BuildUpTests_BuildUp_As_InterfaceType()
        {
            using var container = new StashboxContainer();
            container.Register <ITest3, Test3>().Register <ITest, Test>();
            var test3 = new Test3();
            var inst  = (Test3)container.BuildUp <ITest3>(test3);

            Assert.NotNull(inst.Test);
        }
コード例 #3
0
        public void ResolveFactoryTests_FourParams(CompilerType compilerType)
        {
            using var container = new StashboxContainer(c => c.WithCompiler(compilerType));
            container.Register <Test4>();
            var factory = container.ResolveFactory <Test, Test1, Test2, Test3, Test4>();

            var test  = new Test();
            var test1 = new Test1(test);
            var test2 = new Test2(test1, test);
            var test3 = new Test3(test1, test, test2);
            var inst  = factory(test, test1, test2, test3);

            Assert.Same(test, inst.Test);
            Assert.Same(test1, inst.Test1);
            Assert.Same(test2, inst.Test2);
            Assert.Same(test3, inst.Test3);
        }
コード例 #4
0
        public void ResolveFactoryTests_FourParams()
        {
            using (var container = new StashboxContainer())
            {
                container.Register <Test4>();
                var factory = container.ResolveFactory <Test, Test1, Test2, Test3, Test4>();

                var test  = new Test();
                var test1 = new Test1(test);
                var test2 = new Test2(test1, test);
                var test3 = new Test3(test1, test, test2);
                var inst  = factory(test, test1, test2, test3);

                Assert.AreSame(test, inst.Test);
                Assert.AreSame(test1, inst.Test1);
                Assert.AreSame(test2, inst.Test2);
                Assert.AreSame(test3, inst.Test3);
            }
        }