예제 #1
0
        public void PartAOptionalDependsOnPartBAndPartC_PartCGetRecurrected()
        {
            var container = new CompositionContainer(new TypeCatalog(typeof(PartA2), typeof(PartB)));
            var partA     = container.GetExportedValue <PartA2>();

            Assert.Null(partA.ImportB);
            Assert.Null(partA.ImportC);

            var partC = new PartC();

            container.ComposeParts(partC);

            Assert.Equal(partA.ImportB, partC.ImportB);
            Assert.Equal(partA.ImportC, partC);
        }
예제 #2
0
        public void PartAOptionalDependsOnPartBAndPartC_PartCGetRecurrected()
        {
            var container = new CompositionContainer(new TypeCatalog(typeof(PartA2), typeof(PartB)));
            var partA = container.GetExportedValue<PartA2>();

            Assert.IsNull(partA.ImportB);
            Assert.IsNull(partA.ImportC);

            var partC = new PartC();
            container.ComposeParts(partC);

            Assert.AreEqual(partA.ImportB, partC.ImportB);
            Assert.AreEqual(partA.ImportC, partC);
        }
예제 #3
0
 public override string ToString()
 {
     return(string.Format("{0}.{1}.{2}.{3}", PartA.ToString(), PartB.ToString(), PartC.ToString(), PartD.ToString()));
 }
예제 #4
0
 public void SetPartC(PartC partC)
 {
     this.partC = partC;
 }