Mef Composition Container Unit Test

pianoboy11 1 Reputation point
2021-11-04T03:23:02.817+00:00

Can someone assist me in writing a unit test for the code in orange. I am trying to write a unit test for the CompositionContainer and ComposePart

//An aggregate catalog that combines multiple catalogs

var catalog = new AggregateCatalog();

//Adds all the parts found in the same assembly as the current class

catalog.Catalogs.Add(new AssemblyCatalog(typeof(this).Assembly));

//If parts are placed at some other location then adds that directory path

catalog.Catalogs.Add(new DirectoryCatalog(componentsDirectoryPath));

//Create the CompositionContainer with the parts in the catalog
CompositionContainer _container = new CompositionContainer(catalog);

//Fill the imports of this object

this._container.ComposeParts(this);

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,245 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
329 questions
{count} votes