Пример #1
0
        public void RegisterTransient_Success()
        {
            ITestCase testCase = new TransientTestCaseB(new AutofacRegistration(), new AutofacResolving());


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

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


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


            var c = new StandardKernel();

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

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


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterTransient_Success()
        {
            ITestCase testCase = new TransientTestCaseB(new NiquIoCFullRegistration(), new NiquIoCFullResolving());


            var c = new Container();

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

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


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
        public void RegisterTransient_Success()
        {
            ITestCase testCase = new TransientTestCaseB(new UnityRegistration(), new UnityResolving());


            var c = new UnityContainer();

            c = (UnityContainer)testCase.Register(c, RegistrationKind.Transient);

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


            CheckHelper.Check(obj1, false, false);
            CheckHelper.Check(obj2, false, false);
            CheckHelper.Check(obj1, obj2, false, false);
        }
Пример #5
0
        public void RegisterTransient_Success()
        {
            ITestCase testCase = new TransientTestCaseB(new LightInjectRegistration(), new LightInjectResolving());


            var c = new ServiceContainer();

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

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


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

            var c = new DependencyInjectionContainer();

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


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


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