public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new AutofacRegistration(), new AutofacResolving());

            var cb = new ContainerBuilder();
            var c  = (IContainer)testCase.Register(cb, RegistrationKind.FactoryMethod);

            var obj1 = c.Resolve <ITestA>();
            var obj2 = c.Resolve <ITestA>();


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new GraceRegistration(), new GraceResolving());

            var c = new DependencyInjectionContainer();

            c = (DependencyInjectionContainer)testCase.Register(c, RegistrationKind.FactoryMethod);

            var obj1 = c.Locate <ITestA>();
            var obj2 = c.Locate <ITestA>();


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new WindsorRegistration(), new WindsorResolving());

            var c = new WindsorContainer();

            c = (WindsorContainer)testCase.Register(c, RegistrationKind.FactoryMethod);

            var obj1 = c.Resolve <ITestA>();
            var obj2 = c.Resolve <ITestA>();


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
Esempio n. 4
0
        public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new NiquIoCFullRegistration(), new NiquIoCFullResolving());

            var c = new Container();

            c = (Container)testCase.Register(c, RegistrationKind.FactoryMethod);

            var obj1 = c.Resolve <ITestA>(ResolveKind.FullEmitFunction);
            var obj2 = c.Resolve <ITestA>(ResolveKind.FullEmitFunction);


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new LightInjectRegistration(), new LightInjectResolving());

            var c = new ServiceContainer();

            c = (ServiceContainer)testCase.Register(c, RegistrationKind.FactoryMethod);

            var obj1 = c.GetInstance <ITestA>();
            var obj2 = c.GetInstance <ITestA>();


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterFactoryMethod_Success()
        {
            ITestCase testCase = new FactoryMethodTestCaseA(new NinjectRegistration(), new NinjectResolving());

            var c = new StandardKernel();

            c = (StandardKernel)testCase.Register(c, RegistrationKind.FactoryMethod);

            var obj1 = c.Get <ITestA>();
            var obj2 = c.Get <ITestA>();


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }