/// <summary>
        /// Overload that imports using a SingleObjectImporter and checks that the expected
        /// implementing type was imported.
        /// </summary>
        /// <remarks>This method can be used if the import being tested doesn't specify an explicit contract name.
        /// If it does use an explicit contract name you will need to call the other overload and supply an
        /// importer with a property with the appropriate [Import("MyContractName")] attribute.</remarks>
        public static SingleObjectImporter <TImportType> CheckTypeCanBeImported <TTypeToCheck, TImportType>(
            IEnumerable <Export> optionalExports,
            IEnumerable <Export> requiredExports)
            where TImportType : class
            where TTypeToCheck : class
        {
            SingleObjectImporter <TImportType> importer = new SingleObjectImporter <TImportType>();

            CheckTypeCanBeImported <TTypeToCheck, TImportType>(importer, optionalExports, requiredExports);

            importer.AssertImportIsNotNull();
            importer.AssertImportIsInstanceOf <TTypeToCheck>();
            return(importer);
        }
        public void MefCtor_CheckExports()
        {
            var batch = new CompositionBatch();

            var serviceProvider = MefTestHelpers.CreateExport <SVsServiceProvider>(Mock.Of <IServiceProvider>());

            batch.AddExport(serviceProvider);

            var helperImport       = new SingleObjectImporter <IProjectSystemHelper>();
            var vsHierarchyLocator = new SingleObjectImporter <IVsHierarchyLocator>();

            batch.AddPart(helperImport);
            batch.AddPart(vsHierarchyLocator);

            var catalog = new TypeCatalog(typeof(ProjectSystemHelper));

            using var container = new CompositionContainer(catalog);
            container.Compose(batch);

            helperImport.Import.Should().NotBeNull();
            vsHierarchyLocator.Import.Should().NotBeNull();

            helperImport.Import.Should().BeSameAs(vsHierarchyLocator.Import);
        }