Exemple #1
0
        public void SelectiveImportBasedOnMetadataForExport()
        {
            CompositionContainer container = ContainerFactory.Create();

            MyImporterWithExportForSelectiveImport importer;
            CompositionBatch batch = new CompositionBatch();

            batch.AddPart(new MyExporterWithNoMetadata());
            batch.AddPart(new MyExporterWithMetadata());
            batch.AddPart(importer = new MyImporterWithExportForSelectiveImport());

            throw new NotImplementedException();
            //var result = container.TryCompose();

            //Assert.True(result.Succeeded, "Composition should be successfull because one of two exports meets both the contract name and metadata requirement");
            //Assert.Equal(1, result.Issues.Count);
            //Assert.True(result.Issues[0].Description.Contains("Foo"), "The missing required metadata is 'Foo'");
            //Assert.NotNull(importer.ValueInfo, "The import should really get bound");
        }
Exemple #2
0
        public void SelectiveImportBasedOnMetadataForExport()
        {
            CompositionContainer container = ContainerFactory.Create();

            MyImporterWithExportForSelectiveImport importer;
            CompositionBatch batch = new CompositionBatch();
            batch.AddPart(new MyExporterWithNoMetadata());
            batch.AddPart(new MyExporterWithMetadata());
            batch.AddPart(importer = new MyImporterWithExportForSelectiveImport());

            Assert.Fail();
            //var result = container.TryCompose();

            //Assert.IsTrue(result.Succeeded, "Composition should be successfull because one of two exports meets both the contract name and metadata requirement");
            //Assert.AreEqual(1, result.Issues.Count, "There should be one issue reported about the export who has no required metadata");
            //Assert.IsTrue(result.Issues[0].Description.Contains("Foo"), "The missing required metadata is 'Foo'");
            //Assert.IsNotNull(importer.ValueInfo, "The import should really get bound");
        }