Exemplo n.º 1
0
        public async Task <IEnumerable <PluginPageComponent> > GetPages()
        {
            await PageLock.WaitAsync();

            var pages = _pluginResolver.GetPageComponents();

            PageLock.Release();

            return(pages);
        }
Exemplo n.º 2
0
        public void SetPluginPageComponentTest()
        {
            //Arrange
            PluginResolver pluginResolver = new PluginResolver();

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

            var oldComponent = pluginResolver.GetPageComponents().First();

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

            var newComponent = new TestPageComponent();

            //Act
            pluginResolver.SetPluginPageComponent(newComponent);

            //Assert
            Assert.NotEqual(oldComponent, pluginResolver.GetPageComponents().First());
            Assert.Equal("TestKey", newComponent.PluginKey);
            Assert.NotNull(newComponent.Data);
            Assert.NotNull(newComponent.PluginSettings);
        }
Exemplo n.º 3
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);
        }