예제 #1
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);
        }
예제 #2
0
        public async Task <PluginSettingsComponent> GetSettingComponent(string pluginKey)
        {
            await SettingsLock.WaitAsync();

            var settings = _pluginResolver.GetSettingComponent(pluginKey);

            SettingsLock.Release();

            return(settings);
        }