Exemple #1
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)));
        }
Exemple #2
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);
        }
Exemple #3
0
 private void LoadPluginPages(Type pluginType)
 {
     _pluginResolver.LoadPluginPages(pluginType);
 }