Beispiel #1
0
        public virtual void Should_Dispose_From_Containers()
        {
            DefaultKernel disposableKernel = new DefaultKernel();
            using (var disposableLocater = new SiegeContainer(new WindsorAdapter.WindsorAdapter(disposableKernel)))
            {
                disposableLocater.Register(Given<ITestInterface>.Then<TestCase1>());
                Assert.IsTrue(disposableLocater.GetInstance<ITestInterface>() is TestCase1);
            }

            Assert.IsFalse(disposableKernel.HasComponent(typeof(ITestInterface)));
        }
		public void ChildKernelFindsAndCreateParentComponent()
		{
			IKernel subkernel = new DefaultKernel();

			Kernel.Register(Component.For(typeof(DefaultTemplateEngine)).Named("templateengine"));

			Kernel.AddChildKernel(subkernel);

			Assert.IsTrue(subkernel.HasComponent(typeof(DefaultTemplateEngine)));
			Assert.IsNotNull(subkernel.Resolve<DefaultTemplateEngine>());
		}