예제 #1
0
        public void TestConstructByFactory()
        {
            Container.Bind <Test2>().ToSingle();

            var val     = new Test1();
            var factory = new FactoryUntyped <Test2>(Container);
            var test1   = factory.Create(val);

            TestAssert.That(test1.val == val);
        }
예제 #2
0
        public void TestExtraParametersSameType()
        {
            var factory1 = new FactoryUntyped <Test1>(Container);
            var test1    = factory1.Create(5, 10);

            TestAssert.That(test1 != null);
            TestAssert.That(test1.f1 == 5 && test1.f2 == 10);

            var factory2 = new FactoryUntyped <Test1>(Container);
            var test2    = factory2.Create(10, 5);

            TestAssert.That(test2 != null);
            TestAssert.That(test2.f1 == 10 && test2.f2 == 5);
        }