public void RegisterSingleton_Success()
        {
            ITestCase testCase = new SingletonTestCaseA(new AutofacRegistration(), new AutofacResolving());

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

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


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

            var c = new DependencyInjectionContainer();

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


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


            CheckHelper.Check(obj1, true, true);
            CheckHelper.Check(obj2, true, true);
            CheckHelper.Check(obj1, obj2, true, true);
        }
        public void RegisterSingleton_Success()
        {
            ITestCase testCase = new SingletonTestCaseA(new WindsorRegistration(), new WindsorResolving());


            var c = new WindsorContainer();

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

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


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


            var c = new Container();

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

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


            CheckHelper.Check(obj1, true, true);
            CheckHelper.Check(obj2, true, true);
            CheckHelper.Check(obj1, obj2, true, true);
        }
Пример #5
0
        public void RegisterSingleton_Success()
        {
            ITestCase testCase = new SingletonTestCaseA(new NiquIoCFullRegistration(), new NiquIoCFullResolving());


            var c = new Container();

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

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


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


            var c = new StandardKernel();

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

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


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