public void InitializeDocumentationLoadTest() { lock (_documentationLoadPlugin) { while (_pluginLoaded.HasValue && !_pluginLoaded.Value) { System.Threading.Thread.Sleep(30); } if (_pluginLoaded.HasValue && _pluginLoaded.Value) { return; } if (_pluginLoaded == null) { _pluginLoaded = false; } _documentationLoadPlugin = new TestSearchPluginManager(); _documentationLoadPlugin.AddAssembly(Assembly.GetExecutingAssembly()); _documentationLoadPlugin.UsePlugin(typeof(DemoWebsite.Classes.PluginInitialisation)); _documentationLoadPlugin.UsePlugin(typeof(DocumentationPlugin.PluginInitialisation)); _documentationLoadPlugin.UsePlugin(typeof(MemoryCache.Plugin.PluginInitialisation)); _documentationLoadPlugin.UsePlugin(typeof(ProductPlugin.PluginInitialisation)); _documentationLoadPlugin.ConfigureServices(); _pluginServices = new pm.PluginServices(_documentationLoadPlugin) as IPluginClassesService; TimeSpan docLoadTime = new TimeSpan(0, 0, 30); DateTime startLoadDocs = DateTime.Now; while (Shared.Classes.ThreadManager.Exists(SharedPluginFeatures.Constants.DocumentationLoadThread)) { System.Threading.Thread.Sleep(100); if (DateTime.Now - startLoadDocs > docLoadTime) { break; } } Assert.IsFalse(Shared.Classes.ThreadManager.Exists(SharedPluginFeatures.Constants.DocumentationLoadThread)); _documentationService = (IDocumentationService)_documentationLoadPlugin.GetServiceProvider() .GetService(typeof(IDocumentationService)); Assert.IsNotNull(_documentationService); Assert.IsTrue(_documentationService.GetDocuments().Count > 100); _pluginLoaded = true; } Assert.IsNotNull(_pluginServices); }
public void FindAllProvidersAndRetrieveInstanciatedClasses() { Assert.IsFalse(Shared.Classes.ThreadManager.Exists(SharedPluginFeatures.Constants.DocumentationLoadThread)); IDocumentationService documentationService = (IDocumentationService)_documentationLoadPlugin.GetServiceProvider() .GetService(typeof(IDocumentationService)); Assert.IsNotNull(documentationService); Assert.IsTrue(documentationService.GetDocuments().Count > 100); }