public void NestedWorkItemIntegrationTest()
        {
            WorkItem parentWorkItem = new TestableRootWorkItem();
            WorkItem childWorkItem  = parentWorkItem.WorkItems.AddNew <WorkItem>();

            MockA a = new MockA();
            MockA b = new MockA();

            parentWorkItem.Services.Add(typeof(MockA), a);
            childWorkItem.Services.Add(typeof(MockA), b);

            Assert.AreSame(a, parentWorkItem.Services.Get <MockA>());
            Assert.AreSame(b, childWorkItem.Services.Get <MockA>());

            MockB c = new MockB();

            parentWorkItem.Services.Add(typeof(MockB), c);

            // Throws ArgumentException
            childWorkItem.Services.AddOnDemand(typeof(MockB));
        }
        public void NestedContainerIntegrationTest()
        {
            CompositionContainer parentContainer = new TestableRootCompositionContainer();
            CompositionContainer childContainer  = parentContainer.Containers.AddNew <CompositionContainer>();

            MockA a = new MockA();
            MockA b = new MockA();

            parentContainer.Services.Add(typeof(MockA), a);
            childContainer.Services.Add(typeof(MockA), b);

            Assert.AreSame(a, parentContainer.Services.Get <MockA>());
            Assert.AreSame(b, childContainer.Services.Get <MockA>());

            MockB c = new MockB();

            parentContainer.Services.Add(typeof(MockB), c);

            // Throws ArgumentException
            childContainer.Services.AddOnDemand(typeof(MockB));
        }
        public void NestedContainerIntegrationTest()
        {
            CompositionContainer parentContainer = new TestableRootCompositionContainer();
            CompositionContainer childContainer = parentContainer.Containers.AddNew<CompositionContainer>();

            MockA a = new MockA();
            MockA b = new MockA();

            parentContainer.Services.Add(typeof (MockA), a);
            childContainer.Services.Add(typeof (MockA), b);

            Assert.AreSame(a, parentContainer.Services.Get<MockA>());
            Assert.AreSame(b, childContainer.Services.Get<MockA>());

            MockB c = new MockB();

            parentContainer.Services.Add(typeof (MockB), c);

            // Throws ArgumentException
            childContainer.Services.AddOnDemand(typeof (MockB));
        }