Ejemplo n.º 1
0
        public void TestStepScopeProperty1()
        {
            IUnityContainer container = new UnityContainer();
            container.AddNewExtension<StepScopeExtension>();
            container.RegisterSingleton<A>("a", new InjectionConstructor(), new InjectionProperty("I", new ResolvedParameter<B>("i")));
            container.RegisterStepScope<B>("i");

            Check(container);
        }
Ejemplo n.º 2
0
        public void TestStepScopeUnchanged()
        {
            IUnityContainer container = new UnityContainer();
            container.AddNewExtension<StepScopeExtension>();
            container.RegisterSingleton<A>("a", new InjectionConstructor(new ResolvedParameter<B>("i")));
            container.RegisterStepScope<B>("i");
            container.RegisterType<I, B>("i");

            var a = container.Resolve<A>("a");

            Assert.IsNotNull(a.I);
            Assert.IsTrue(a.I is IProxyObject);
        }
Ejemplo n.º 3
0
        public void TestStepScopeMethod3()
        {
            IUnityContainer container = new UnityContainer();
            container.AddNewExtension<StepScopeExtension>();
            container.RegisterSingleton<A>("a", new InjectionConstructor(), new InjectionMethod("SetI", new ResolvedParameter<B>()));
            container.RegisterStepScope<B>();

            Check(container);
        }