vs-mef works well for testing applications, but it can be difficult to create and manage IExportProviderFactory instances that provide ideal behavior for testing. dotnet/roslyn has been iterating on this concept, and currently uses the following two types as the core of the testing functionality:
TestComposition: Assists in caching IExportProviderFactory instances for equivalent compositions
ExportProviderCache: Ensures that only one ExportProvider is created in the context of a given test
UseExportProviderAttribute: Ensures that an ExportProvider created by one test is not reused outside the context of that test
It may be worth building a library with tools to assist other application developers write tests with one or more of these concepts.
vs-mef works well for testing applications, but it can be difficult to create and manage
IExportProviderFactoryinstances that provide ideal behavior for testing. dotnet/roslyn has been iterating on this concept, and currently uses the following two types as the core of the testing functionality:TestComposition: Assists in cachingIExportProviderFactoryinstances for equivalent compositionsExportProviderCache: Ensures that only oneExportProvideris created in the context of a given testUseExportProviderAttribute: Ensures that anExportProvidercreated by one test is not reused outside the context of that testIt may be worth building a library with tools to assist other application developers write tests with one or more of these concepts.