public void PolicyShouldRequestTypeMappingFromContainer()
        {
            TestableRootCompositionContainer container = new TestableRootCompositionContainer();

            container.RegisterTypeMapping <IFoo, Foo>();

            ContainerAwareTypeMappingPolicy policy = new ContainerAwareTypeMappingPolicy();

            string requestId = "My mapped object";
            DependencyResolutionLocatorKey requestKey =
                new DependencyResolutionLocatorKey(typeof(IFoo), requestId);
            DependencyResolutionLocatorKey result = policy.Map(container.Locator, requestKey);

            Assert.AreEqual(typeof(Foo), result.Type);
            Assert.AreEqual(requestId, result.ID);
        }
        public void PolicyCallsUpToParentContainerToGetMapping()
        {
            TestableRootCompositionContainer container = new TestableRootCompositionContainer();

            container.RegisterTypeMapping <IFoo, Foo>();
            CompositionContainer child = container.Containers.AddNew <CompositionContainer>();

            ContainerAwareTypeMappingPolicy policy = new ContainerAwareTypeMappingPolicy();

            string requestId = "My mapped object";
            DependencyResolutionLocatorKey requestKey =
                new DependencyResolutionLocatorKey(typeof(IFoo), requestId);
            DependencyResolutionLocatorKey result = policy.Map(child.Locator, requestKey);

            Assert.AreEqual(typeof(Foo), result.Type);
            Assert.AreEqual(requestId, result.ID);
        }