예제 #1
0
        static void ProcessImageThread(object img)
        {
            byte[] image;

            using (MemoryStream ms = new MemoryStream())
            {
                var pic = (Image)img;
                pic.Save(ms, ImageFormat.Png);
                image = ms.ToArray();
            }

            string method = ConfigurationManager.AppSettings["OutputMethod"];

            try
            {
                var plugin = PluginResolver.GetPlugin(method);

                plugin.SaveImage(image);

                Trace.WriteLine(DateTime.Now + " - Image processed");
            }
            catch (Exception e)
            {
                MessageBox.Show(Resources.Resources.GetString("ErrorProcessingImage"), Resources.Resources.GetString("ErrorText"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                Trace.WriteLine(DateTime.Now + " - Error processing image: " + e.ToString());
            }
        }
예제 #2
0
        public void LoadTilesTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            TileManager   tileManager   = new TileManager(pluginResolver, pluginManager, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            //Act
            tileManager.LoadTiles(Assembly.GetExecutingAssembly(), new List <Tuple <string, Type> >
            {
                new Tuple <string, Type>("TestTileKey", typeof(TestTileComponent))
            }).ToList();

            //Assert
            var plugin = pluginResolver.GetPlugin("TestKey");

            Assert.Single(plugin.PluginTiles);
            Assert.Equal("TestTileKey", plugin.PluginTiles.First().Key);
            Assert.Null(plugin.PluginTiles.First().Value.Item1);
            Assert.NotNull(plugin.PluginTiles.First().Value.Item2);
        }
예제 #3
0
 public TileManager(PluginResolver pluginResolver, PluginManager pluginManager, PluginSettingsManager pluginSettingsManager)
 {
     _pluginResolver        = pluginResolver;
     _pluginManager         = pluginManager;
     _pluginSettingsManager = pluginSettingsManager;
     TileLock = new SemaphoreSlim(1, 1);
 }
예제 #4
0
        public async Task GetPluginTileComponentTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            TileManager   tileManager   = new TileManager(pluginResolver, pluginManager, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            tileManager.LoadTiles(Assembly.GetExecutingAssembly(), new List <Tuple <string, Type> >
            {
                new Tuple <string, Type>("TestTileKey", typeof(TestTileComponent))
            }).ToList();

            //Act
            var component = await tileManager.GetPluginTileComponent("TestKey", "TestTileKey");

            //Assert
            Assert.NotNull(component);
            Assert.Equal(typeof(TestTileComponent).FullName, component.GetType().FullName);
        }
예제 #5
0
        public async Task GetPluginInstancesTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            TileManager   tileManager   = new TileManager(pluginResolver, pluginManager, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            tileManager.LoadTiles(Assembly.GetExecutingAssembly(), new List <Tuple <string, Type> >
            {
                new Tuple <string, Type>("TestTileKey", typeof(TestTileComponent))
            });

            //Act
            var plugins = await pluginManager.GetPluginInstances();

            //Assert
            //we expect 1 plugin
            Assert.Single(plugins);
        }
예제 #6
0
        public void GetPluginInstanceTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            TileManager   tileManager   = new TileManager(pluginResolver, pluginManager, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            tileManager.LoadTiles(Assembly.GetExecutingAssembly(), new List <Tuple <string, Type> >
            {
                new Tuple <string, Type>("TestTileKey", typeof(TestTileComponent))
            });

            //Act
            var plugin = pluginManager.GetPluginInstance(new TestTileComponent());

            //Assert
            //we expect 1 plugin
            Assert.Equal(typeof(TestPlugin.TestPlugin).FullName, plugin.GetType().FullName);
            Assert.Equal("TestKey", plugin.Key);
        }
예제 #7
0
        public async Task SetPluginSettingComponentTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager   pluginManager   = new PluginManager(pluginResolver);
            SettingsManager settingsManager = new SettingsManager(pluginManager, null, pluginResolver, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            settingsManager.LoadSettings(Assembly.GetExecutingAssembly()).ToList();

            var oldComponent = await settingsManager.GetSettingComponent("TestKey");

            var pluginSettings = new PluginData();

            oldComponent.SettingsData = pluginSettings;

            //Act
            await settingsManager.SetPluginSettingsComponent(new TestSettingsComponent
            {
                SettingsData = pluginSettings
            });

            var newComponent = await settingsManager.GetSettingComponent("TestKey");

            //Assert
            Assert.NotNull(newComponent);
            Assert.Equal("TestKey", newComponent.PluginKey);
            Assert.Equal(oldComponent.SettingsData, newComponent.SettingsData);
        }
예제 #8
0
        public void SetPluginTileComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginTileComponent(typeof(TestTileComponent), "TestTileKey");

            var oldComponent = pluginResolver.GetPluginTileComponent("TestKey", "TestTileKey");

            oldComponent.Data           = new PluginData();
            oldComponent.PluginSettings = new PluginData();

            var newComponent = new TestTileComponent();

            //Act
            pluginResolver.SetPluginTileComponent("TestTileKey", newComponent);

            //Assert
            Assert.NotEqual(oldComponent, pluginResolver.GetPluginTileComponent("TestKey", "TestTileKey"));
            Assert.Equal(newComponent, pluginResolver.GetPluginTileComponent("TestKey", "TestTileKey"));
            Assert.Equal("TestKey", newComponent.PluginKey);
            Assert.Equal("TestTileKey", newComponent.TileKey);
            Assert.NotNull(newComponent.Data);
            Assert.NotNull(newComponent.PluginSettings);
        }
예제 #9
0
 public SettingsManager(PluginManager pluginManager, HttpClient httpClient, PluginResolver pluginResolver, PluginSettingsManager pluginSettingsManager)
 {
     _pluginManager         = pluginManager;
     _httpClient            = httpClient;
     _pluginResolver        = pluginResolver;
     _pluginSettingsManager = pluginSettingsManager;
     SettingsLock           = new SemaphoreSlim(1, 1);
     TileLock = new SemaphoreSlim(1, 1);
 }
예제 #10
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo(ConfigurationManager.AppSettings["Culture"]);

            PluginResolver.LoadPluginsFromDirectory(ConfigurationManager.AppSettings["PluginDir"]);

            Trace.WriteLine(DateTime.Now + " - Application started");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
예제 #11
0
        public void GetSettingsTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginSettings(typeof(TestPlugin.TestPlugin));

            //Act
            var settings = pluginResolver.GetSettings("TestKey");

            //Assert
            Assert.NotNull(settings);
        }
예제 #12
0
        public void GetSettingComponentsTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginSettingsComponent(typeof(TestSettingsComponent), null);

            //Act
            var settingsComponents = pluginResolver.GetSettingComponents().ToList();

            //Assert
            Assert.NotNull(settingsComponents);
            Assert.Single(settingsComponents);
        }
예제 #13
0
        public void GetMainPageTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginPageComponent(typeof(TestPageComponent));
            pluginResolver.LoadPluginPageComponent(typeof(MainTestPageComponent));

            //Act
            var mainPage = pluginResolver.GetMainPage(typeof(TestPlugin.TestPlugin));

            //Assert
            Assert.NotNull(mainPage);
            Assert.Equal(typeof(MainTestPageComponent), mainPage.GetType());
        }
예제 #14
0
        public void LoadPluginSettingsComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");

            //Act
            pluginResolver.LoadPluginSettingsComponent(typeof(TestSettingsComponent), null);

            //Assert
            var plugin = pluginResolver.GetPlugin(typeof(TestPlugin.TestPlugin));

            Assert.NotNull(plugin.PluginSettingsComponent);
            Assert.Equal(typeof(TestSettingsComponent), plugin.PluginSettingsComponent.GetType());
        }
예제 #15
0
        public void GetPluginTileComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginTileComponent(typeof(TestTileComponent), "TestTileKey");

            //Act
            var tileComponent = pluginResolver.GetPluginTileComponent("TestKey", "TestTileKey");

            //Assert
            Assert.NotNull(tileComponent);
            Assert.Equal(typeof(TestTileComponent), tileComponent.GetType());
            Assert.Equal("TestTileKey", tileComponent.TileKey);
            Assert.Equal("TestKey", tileComponent.PluginKey);
        }
예제 #16
0
        public void LoadPluginsTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);

            //Act
            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            //Assert
            //we expect 1 plugin
            Assert.Single(pluginResolver.GetPlugins());
            Assert.Equal(typeof(TestPlugin.TestPlugin).FullName, pluginResolver.GetPlugins().First().PluginInstance.GetType().FullName);
        }
예제 #17
0
        public void GetPageComponentsTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginPageComponent(typeof(TestPageComponent));
            pluginResolver.LoadPluginPageComponent(typeof(MainTestPageComponent));

            //Act
            var pageComponents = pluginResolver.GetPageComponents().ToList();

            //Assert
            Assert.NotNull(pageComponents);
            Assert.Equal(2, pageComponents.Count);
            Assert.Equal("TestKey", pageComponents[0].PluginKey);
            Assert.Equal("TestKey", pageComponents[1].PluginKey);
            Assert.True(pageComponents[1].IsMainPage);
        }
예제 #18
0
        public void SetPluginSettingsComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginSettingsComponent(typeof(TestSettingsComponent), null);

            var oldComponent = pluginResolver.GetSettingComponent("TestKey");

            var newComponent = new TestSettingsComponent();

            //Act
            pluginResolver.SetPluginSettingsComponent(newComponent);

            //Assert
            Assert.NotEqual(oldComponent, pluginResolver.GetSettingComponent("TestKey"));
            Assert.Equal("TestKey", newComponent.PluginKey);
        }
예제 #19
0
        public void GetPluginPagesTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginPages(typeof(TestPlugin.TestPlugin));

            //Act
            var pages = pluginResolver.GetPluginPages("TestKey").ToList();

            //Assert
            Assert.Equal(2, pages.Count);
            Assert.Equal(2, pages.Count(page => page.PluginKey == "TestKey"));

            //make sure the right amount of pages are in the list
            Assert.Single(pages.Where(tile => tile.GetType() == typeof(TestPage)));
            Assert.Single(pages.Where(tile => tile.GetType() == typeof(MainTestPage)));
        }
예제 #20
0
        public async Task SetPluginTileComponentTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            TileManager   tileManager   = new TileManager(pluginResolver, pluginManager, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            tileManager.LoadTiles(Assembly.GetExecutingAssembly(), new List <Tuple <string, Type> >
            {
                new Tuple <string, Type>("TestTileKey", typeof(TestTileComponent))
            }).ToList();

            var oldComponent = await tileManager.GetPluginTileComponent("TestKey", "TestTileKey");

            var data           = new PluginData();
            var pluginSettings = new PluginData();

            oldComponent.Data           = data;
            oldComponent.PluginSettings = pluginSettings;

            //Act
            await tileManager.SetPluginTileComponent("TestTileKey", new TestTileComponent
            {
                Data           = data,
                PluginSettings = pluginSettings
            });

            var newComponent = await tileManager.GetPluginTileComponent("TestKey", "TestTileKey");

            //Assert
            Assert.NotNull(newComponent);
            Assert.Equal("TestKey", newComponent.PluginKey);
            Assert.Equal("TestTileKey", newComponent.TileKey);
            Assert.Equal(oldComponent.Data, newComponent.Data);
            Assert.Equal(oldComponent.PluginSettings, newComponent.PluginSettings);
        }
예제 #21
0
        public void GetPluginTilesTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");
            pluginResolver.LoadPluginTile(typeof(TestPlugin.TestPlugin), typeof(TestTile), "TestTileKey");
            pluginResolver.LoadPluginTile(typeof(TestPlugin.TestPlugin), typeof(TestTile2), "TestTile2Key");

            //Act
            var tiles = pluginResolver.GetPluginTiles("TestKey").ToList();

            //Assert
            Assert.Equal(2, tiles.Count);
            Assert.Equal(1, tiles.Count(tile => tile.TileKey == "TestTileKey"));
            Assert.Equal(1, tiles.Count(tile => tile.TileKey == "TestTile2Key"));

            //make sure the tiles are not null
            Assert.NotNull(tiles.First(tile => tile.TileKey == "TestTileKey"));
            Assert.NotNull(tiles.First(tile => tile.TileKey == "TestTileKey"));
        }
예제 #22
0
        public void LoadPluginPagesTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");

            //Act
            pluginResolver.LoadPluginPages(typeof(TestPlugin.TestPlugin));

            //Assert
            var plugin = pluginResolver.GetPlugin(typeof(TestPlugin.TestPlugin));

            Assert.Equal(2, plugin.PluginPages.Count);

            //make sure the page instance is not null
            Assert.NotNull(plugin.PluginPages.First().Value.Item1);
            //we only load the IPage so the component SHOULD be null
            Assert.Null(plugin.PluginPages.First().Value.Item2);
            Assert.Equal("TestKey", plugin.PluginPages.First().Value.Item1.PluginKey);
        }
예제 #23
0
        public async Task SetPluginPageComponentTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            PageManager   pageManager   = new PageManager(pluginResolver);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            pageManager.LoadPages(Assembly.GetExecutingAssembly()).ToList();

            var oldComponent = await pageManager.GetPage("TestKey", "/test");

            var data           = new PluginData();
            var pluginSettings = new PluginData();

            oldComponent.Data           = data;
            oldComponent.PluginSettings = pluginSettings;

            //Act
            await pageManager.SetPluginPageComponent(new TestPageComponent
            {
                Data           = data,
                PluginSettings = pluginSettings
            });

            var newComponent = await pageManager.GetPage("TestKey", "/test");

            //Assert
            Assert.NotNull(newComponent);
            Assert.Equal("TestKey", newComponent.PluginKey);
            Assert.Equal("/test", newComponent.RelativePath);
            Assert.Equal(oldComponent.Data, newComponent.Data);
            Assert.Equal(oldComponent.PluginSettings, newComponent.PluginSettings);
        }
예제 #24
0
        public void LoadPagesTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            PageManager   pageManager   = new PageManager(pluginResolver);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            //Act
            pageManager.LoadPages(Assembly.GetExecutingAssembly()).ToList();

            //Assert
            var plugin = pluginResolver.GetPlugin("TestKey");

            Assert.Equal(2, plugin.PluginPages.Count);
            Assert.Equal("TestKey", plugin.PluginPages.First().Value.Item2.PluginKey);
        }
예제 #25
0
        public async Task GetPageTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager pluginManager = new PluginManager(pluginResolver);
            PageManager   pageManager   = new PageManager(pluginResolver);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            pageManager.LoadPages(Assembly.GetExecutingAssembly()).ToList();

            //Act
            var component = await pageManager.GetPage("TestKey", "/test");

            //Assert
            Assert.NotNull(component);
            Assert.Equal(typeof(TestPageComponent).FullName, component.GetType().FullName);
        }
예제 #26
0
        public void LoadSettingsTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager   pluginManager   = new PluginManager(pluginResolver);
            SettingsManager settingsManager = new SettingsManager(pluginManager, null, pluginResolver, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            //Act
            settingsManager.LoadSettings(Assembly.GetExecutingAssembly()).ToList();

            //Assert
            var plugin = pluginResolver.GetPlugin("TestKey");

            Assert.NotNull(plugin.PluginSettingsComponent);
            Assert.Equal("TestKey", plugin.PluginSettingsComponent.PluginKey);
        }
예제 #27
0
        public async Task GetSettingComponentTest()
        {
            //Arrange
            var pluginResolver = new PluginResolver();

            PluginManager   pluginManager   = new PluginManager(pluginResolver);
            SettingsManager settingsManager = new SettingsManager(pluginManager, null, pluginResolver, null);

            pluginManager.LoadPlugins(Assembly.GetExecutingAssembly(), new Dictionary <string, string>(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("TestKey", nameof(TestPlugin.TestPlugin))
            }));

            settingsManager.LoadSettings(Assembly.GetExecutingAssembly()).ToList();

            //Act
            var component = await settingsManager.GetSettingComponent("TestKey");

            //Assert
            Assert.NotNull(component);
            Assert.Equal(typeof(TestSettingsComponent).FullName, component.GetType().FullName);
        }
예제 #28
0
        public void LoadPluginPageComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");

            //Act
            pluginResolver.LoadPluginPageComponent(typeof(TestPageComponent));

            //Assert
            var plugin = pluginResolver.GetPlugin(typeof(TestPlugin.TestPlugin));

            Assert.Single(plugin.PluginPages);
            Assert.True(plugin.PluginPages.ContainsKey("/test"));

            //make sure the page component is not null
            Assert.NotNull(plugin.PluginPages["/test"].Item2);
            //we only load the component so the IPage SHOULD be null
            Assert.Null(plugin.PluginPages["/test"].Item1);
            Assert.Equal("TestKey", plugin.PluginPages["/test"].Item2.PluginKey);
        }
예제 #29
0
        public void LoadPluginTileTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");

            //Act
            pluginResolver.LoadPluginTile(typeof(TestPlugin.TestPlugin), typeof(TestTile), "TestTileKey");

            //Assert
            var plugin = pluginResolver.GetPlugin(typeof(TestPlugin.TestPlugin));

            Assert.Single(plugin.PluginTiles);
            Assert.True(plugin.PluginTiles.ContainsKey("TestTileKey"));

            //make sure the tile instance is not null
            Assert.NotNull(plugin.PluginTiles["TestTileKey"].Item1);
            //we only load the ITile so the component SHOULD be null
            Assert.Null(plugin.PluginTiles["TestTileKey"].Item2);
            Assert.Equal("TestTileKey", plugin.PluginTiles["TestTileKey"].Item1.TileKey);
            Assert.Equal("TestKey", plugin.PluginTiles["TestTileKey"].Item1.PluginKey);
        }
예제 #30
0
        public void GetPluginTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

            pluginResolver.AddPlugin(typeof(TestPlugin.TestPlugin), "TestKey");

            //Act
            var plugin      = pluginResolver.GetPlugin(typeof(TestPlugin.TestPlugin));
            var pluginAgain = pluginResolver.GetPlugin("TestKey");

            //Assert
            Assert.Equal(plugin, pluginAgain);

            //make sure the plugin and PluginInstance is not null
            Assert.NotNull(plugin);
            Assert.NotNull(plugin.PluginInstance);
            //make sure the plugin has the right key
            Assert.Equal("TestKey", plugin.PluginInstance.Key);
            Assert.Equal("TestKey", pluginAgain.PluginInstance.Key);
            Assert.Equal("TestKey", plugin.PluginKey);
            Assert.Equal("TestKey", pluginAgain.PluginKey);
        }