public void ContainerResolvesServiceLocatorAfterStandardConfiguration()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();

            var candidate = container.Resolve<IServiceLocator>();
        }
        public void ContainerResolveSelfAfterStandardConfiguration()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();
            var candidate = container.Resolve<IUnityContainer>();

            Assert.AreSame(container, candidate); 
        }
        public void ChildContainerResolvesInParent()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();
            container.LoadConfiguration();
            container.ConfigureRegistrars();

            var expected = container.ConfigureChildContainer("test");

            var candidate = container.Resolve<IUnityContainer>("test");

            Assert.AreSame(expected, candidate);
        }
        public void ResolveV2R1EngineAndMappers()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();

            new AnimalMappingEngineRegistrar().Register(container);

            var engine = container.Resolve<IMappingEngine>("V2_1");

            engine.ResolveMapper<Owner, Entity, OwnerEntityMapper>();
            engine.ResolveMapper<Entity, Entity, EntityEntityMapper>();
            engine.ResolveMapper<Animal, AnimalModel, Maps.Common.V2_1.AnimalAnimalModelMapper>();
            engine.ResolveMapper<Child, ChildModel, ChildChildModelMapper>();
        }
        public void ChildResolveChildServiceDirectly()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();
            container.LoadConfiguration();
            container.ConfigureRegistrars();

            var child = container.ConfigureChildContainer("test");

            var expected = typeof(ChildTestClass);
            var candidate = child.Resolve<ITest>("direct2");

            Assert.AreSame(expected, candidate.GetType());  
        }
        public void ResolveV2R1EngineAndMappers()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();

            new XmlSchemaRegistryRegistrar().Register(container);
            new XmlMappingEngineRegistrar().Register(container);
            new XmlMappingEngineFactoryRegistrar().Register(container);

            new AnimalXmlMappingEngineRegistrar().Register(container);

            var factory = container.Resolve<IXmlMappingEngineFactory>();
            var engine = factory.Find("Animal.V2_1");

            engine.ResolveMapper<XPathProcessor, Owner, OwnerXmlMapper>();
            engine.ResolveMapper<XPathProcessor, Entity, EntityXmlMapper>();
            engine.ResolveMapper<XPathProcessor, Animal, Maps.Common.V2_1.AnimalXmlMapper>();
            engine.ResolveMapper<XPathProcessor, Child, ChildXmlMapper>();
        }
        public void FactoryCallInChild()
        {
            var container = new UnityContainer();
            container.StandardConfiguration();
            container.LoadConfiguration();
            container.ConfigureRegistrars();

            var child = container.ConfigureChildContainer("test");

            var factory = child.Resolve<ITestFactory>();

            var expected = typeof(ChildTestClass);
            var candidate = factory.Get();

            Assert.AreSame(expected, candidate.GetType());
        }