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

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

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


            CheckHelper.Check(obj1, false, true);
            CheckHelper.Check(obj2, false, true);
            CheckHelper.Check(obj1, obj2, false, true);
        }
示例#2
0
        public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase = new TransientSingletonTestCaseD(new GraceRegistration(), new GraceResolving());

            var c = new DependencyInjectionContainer();

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

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


            CheckHelper.Check(obj1, false, true);
            CheckHelper.Check(obj2, false, true);
            CheckHelper.Check(obj1, obj2, false, true);
        }
示例#3
0
        public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase = new TransientSingletonTestCaseD(new NinjectRegistration(), new NinjectResolving());

            var c = new StandardKernel();

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

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


            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 TransientSingletonTestCaseD(new NiquIoCFullRegistration(), new NiquIoCFullResolving());

            var c = new Container();

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

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


            CheckHelper.Check(obj1, false, true);
            CheckHelper.Check(obj2, false, true);
            CheckHelper.Check(obj1, obj2, false, true);
        }
示例#5
0
        public void RegisterTransientSingleton_Success()
        {
            ITestCase testCase =
                new TransientSingletonTestCaseD(new LightInjectRegistration(), new LightInjectResolving());

            var c = new ServiceContainer();

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

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


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