Exemple #1
0
        static void Main(string[] args)
        {
            ExtensionsLoader loader = new ExtensionsLoader();

            loader.ImportPlugins();

            System.Console.WriteLine(string.Format("{0} plugins are loaded", loader.NumberOfImportedOperations));

            var result = loader.CallImportedPlugins("Mef Plugins example ", "Plugins");

            foreach (string item in result)
            {
                System.Console.WriteLine(item);
            }

            Console.ReadKey();
        }
Exemple #2
0
        public void TestMethod1()
        {
            // Arrange
            var importer = new ExtensionsLoader();

            importer.ImportPlugins();

            // Act
            var numberOfOps = importer.NumberOfImportedOperations;

            // Assert
            Assert.AreEqual(numberOfOps, 2);
            var ExpectedList = new List <string>()
            {
                "Are All EqualAll", "Are  Equal"
            };
            var resultedList = importer.CallImportedPlugins("Are All Equal", "All");

            Assert.AreEqual(resultedList.Last(), ExpectedList.Last());
        }