Example #1
0
        public void TestLoadDifferentPluginTypes()
        {
            var cache = new PluginCache(_pluginLoader.Object);

            cache.LoadAllOfType <ILogFileOutlinePlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogFileOutlinePlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogEntryParserPlugin>(), Times.Never);

            cache.LoadAllOfType <ILogEntryParserPlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogFileOutlinePlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogEntryParserPlugin>(), Times.Once);
        }
Example #2
0
        public void TestLoadDifferentPluginTypes()
        {
            var cache = new PluginCache(_pluginLoader.Object);

            cache.LoadAllOfType <IWidgetPlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfType <IWidgetPlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfType <ILogAnalyserPlugin>(), Times.Never);

            cache.LoadAllOfType <ILogAnalyserPlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfType <IWidgetPlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfType <ILogAnalyserPlugin>(), Times.Once);
        }
Example #3
0
        public void TestLoadPluginOnlyOnce()
        {
            var cache = new PluginCache(_pluginLoader.Object);

            cache.LoadAllOfType <ILogFileOutlinePlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogFileOutlinePlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogEntryParserPlugin>(), Times.Never);

            cache.LoadAllOfType <ILogFileOutlinePlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogFileOutlinePlugin>(), Times.Once,
                                 "because the cache should not have queried the plugin loader again");
            _pluginLoader.Verify(x => x.LoadAllOfTypeWithDescription <ILogEntryParserPlugin>(), Times.Never);
        }
Example #4
0
        public void TestLoadPluginOnlyOnce()
        {
            var cache = new PluginCache(_pluginLoader.Object);

            cache.LoadAllOfType <IWidgetPlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfType <IWidgetPlugin>(), Times.Once);
            _pluginLoader.Verify(x => x.LoadAllOfType <ILogAnalyserPlugin>(), Times.Never);

            cache.LoadAllOfType <IWidgetPlugin>();
            _pluginLoader.Verify(x => x.LoadAllOfType <IWidgetPlugin>(), Times.Once,
                                 "because the cache should not have queried the plugin loader again");
            _pluginLoader.Verify(x => x.LoadAllOfType <ILogAnalyserPlugin>(), Times.Never);
        }