public void ImportCollectionAsSingleObject()
        {
            var container = ContainerFactory.Create();
            var batch     = new CompositionBatch();
            var importer  = new ImportACollectionObject();
            var exporter  = new ExportACollectionObject();

            batch.AddPart(importer);
            batch.AddPart(exporter);
            container.Compose(batch);

            Assert.Equal(2, importer.MyCollection.Count);
        }
コード例 #2
0
        public void ImportCollectionAsSingleObject()
        {
            // Set variable to ensure the hack is turned off.
            Environment.SetEnvironmentVariable("ONLY_ALLOW_IMPORTMANY", "1");

            var container = ContainerFactory.Create();
            var batch     = new CompositionBatch();
            var importer  = new ImportACollectionObject();
            var exporter  = new ExportACollectionObject();

            batch.AddPart(importer);
            batch.AddPart(exporter);
            container.Compose(batch);

            Assert.AreEqual(2, importer.MyCollection.Count);
        }