Exemplo n.º 1
0
        public virtual void Should_Dispose_From_Containers()
        {
            var disposableContainer = new StandardKernel();
            using (var disposableLocater = new SiegeContainer(new NinjectAdapter.NinjectAdapter(disposableContainer)))
            {
                disposableLocater.Register(Given<ITestInterface>.Then<TestCase1>());
                Assert.IsTrue(disposableLocater.GetInstance<ITestInterface>() is TestCase1);
            }

            Assert.IsTrue(disposableContainer.IsDisposed);
        }
Exemplo n.º 2
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)));
        }