public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase = new TransientSingletonTestCaseA(new AutofacRegistration(), new AutofacResolving());

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

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


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

            var c = new DependencyInjectionContainer();

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

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


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

            var c = new StandardKernel();

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

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


            CheckHelper.Check(obj1, false, true);
            CheckHelper.Check(obj2, false, true);
            CheckHelper.Check(obj1, obj2, false, true);
        }
示例#4
0
        public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase =
                new TransientSingletonTestCaseA(new NiquIoCPartialRegistration(), new NiquIoCPartialResolving());

            var c = new Container();

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

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


            CheckHelper.Check(obj1, false, true);
            CheckHelper.Check(obj2, false, true);
            CheckHelper.Check(obj1, obj2, false, true);
        }
        public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase =
                new TransientSingletonTestCaseA(new StructureMapRegistration(), new StructureMapResolving());

            var c = new Container();

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

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


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