Example #1
0
        public void TestSealContainer()
        {
            var container = new QuickInjectContainer();

            var lifetimeManager = new SynchronizedTestLifetimeManager();

            container.RegisterType <IA>(new ParameterizedLambdaExpressionInjectionFactory <C, IA>(new ExceptionThrowingCodeProvider()));

            container.SealContainer();

            container.RegisterType <F>(lifetimeManager);

            container.Resolve <F>();
        }
Example #2
0
        public void ExceptionThrowingFactoryMethodDoesNotDeadLock()
        {
            var container = new QuickInjectContainer();

            var lifetimeManager = new SynchronizedTestLifetimeManager();

            container.RegisterType <IA>(new ParameterizedLambdaExpressionInjectionFactory <C, IA>(new ExceptionThrowingCodeProvider()));
            container.RegisterType <F>(lifetimeManager);

            container.SealContainer();

            try
            {
                container.Resolve <F>();
            }
            finally
            {
                Assert.AreEqual(true, lifetimeManager.RecoverCalled);
            }
        }