Esempio n. 1
0
        public void TestAbstractionCollectionSharedBetweenContexts()
        {
            var containerSelector         = new RootAndChildSelector();
            var compositeContainerContext = new CompositeContainerContext(
                new ContainerConfiguration(GetType().Assembly), null,
                containerSelector);

            Assert.That(compositeContainerContext.AbstractionConfigurationCollection, Is.InstanceOf <CompositeCollection>());

            var childContextA = compositeContainerContext.MakeChildContext();
            var factoryFromA  = childContextA.AbstractionConfigurationCollection.Get(typeof(CChild)).
                                GetImplementations()[0].GetFactory(Type.EmptyTypes, compositeContainerContext.CreationContext);

            var childContextB = compositeContainerContext.MakeChildContext();
            var factoryFromB  = childContextB.AbstractionConfigurationCollection.Get(typeof(CChild)).
                                GetImplementations()[0].GetFactory(Type.EmptyTypes, compositeContainerContext.CreationContext);

            Assert.AreSame(factoryFromA, factoryFromB);
        }
Esempio n. 2
0
 public override void SetUp()
 {
     base.SetUp();
     selector = new RootAndChildSelector();
 }