/// <summary> /// Creates the TestExecutorExtensionManager. /// </summary> /// <returns>Instance of the TestExecutorExtensionManager</returns> internal static TestExecutorExtensionManager Create() { if (testExecutorExtensionManager == null) { lock (synclock) { if (testExecutorExtensionManager == null) { IEnumerable <LazyExtension <ITestExecutor, Dictionary <string, object> > > unfilteredTestExtensions; IEnumerable <LazyExtension <ITestExecutor, ITestExecutorCapabilities> > testExtensions; TestPluginManager.Instance .GetSpecificTestExtensions <TestExecutorPluginInformation, ITestExecutor, ITestExecutorCapabilities, TestExecutorMetadata>( TestPlatformConstants.TestAdapterEndsWithPattern, out unfilteredTestExtensions, out testExtensions); testExecutorExtensionManager = new TestExecutorExtensionManager( unfilteredTestExtensions, testExtensions, TestSessionMessageLogger.Instance); } } } return(testExecutorExtensionManager); }
/// <summary> /// Gets an instance of the Test Execution Extension Manager for the extension. /// </summary> /// <param name="extensionAssembly"> The extension assembly. </param> /// <returns> The <see cref="TestExecutorExtensionManager"/>. </returns> /// <remarks> /// This would provide an execution extension manager where extensions in /// only the extension assembly provided are discovered. This is not cached. /// </remarks> internal static TestExecutorExtensionManager GetExecutionExtensionManager(string extensionAssembly) { // Get all extensions for ITestExecutor. TestPluginManager.Instance .GetTestExtensions <TestExecutorPluginInformation, ITestExecutor, ITestExecutorCapabilities, TestExecutorMetadata>( extensionAssembly, out var unfilteredTestExtensions1, out var testExtensions1); // Get all extensions for ITestExecutor2. TestPluginManager.Instance .GetTestExtensions <TestExecutorPluginInformation2, ITestExecutor2, ITestExecutorCapabilities, TestExecutorMetadata>( extensionAssembly, out var unfilteredTestExtensions2, out var testExtensions2); // Merge the extension lists. var mergedUnfilteredTestExtensions = TestExecutorExtensionManager.MergeTestExtensionLists( unfilteredTestExtensions1, unfilteredTestExtensions2); var mergedTestExtensions = TestExecutorExtensionManager.MergeTestExtensionLists( testExtensions1, testExtensions2); // TODO: This can be optimized - The base class's populate map would be called repeatedly for the same extension assembly. // Have a single instance of TestExecutorExtensionManager that keeps populating the map iteratively. return(new TestExecutorExtensionManager( mergedUnfilteredTestExtensions, mergedTestExtensions, TestSessionMessageLogger.Instance)); }
/// <summary> /// Destroy the TestExecutorExtensionManager. /// </summary> internal static void Destroy() { lock (synclock) { testExecutorExtensionManager = null; } }
/// <summary> /// Creates the TestExecutorExtensionManager. /// </summary> /// <returns>Instance of the TestExecutorExtensionManager</returns> internal static TestExecutorExtensionManager Create() { if (testExecutorExtensionManager == null) { lock (synclock) { if (testExecutorExtensionManager == null) { IEnumerable <LazyExtension <ITestExecutor, Dictionary <string, object> > > unfilteredTestExtensions1; IEnumerable <LazyExtension <ITestExecutor2, Dictionary <string, object> > > unfilteredTestExtensions2; IEnumerable <LazyExtension <ITestExecutor, ITestExecutorCapabilities> > testExtensions1; IEnumerable <LazyExtension <ITestExecutor2, ITestExecutorCapabilities> > testExtensions2; // Get all extensions for ITestExecutor. TestPluginManager.Instance .GetSpecificTestExtensions <TestExecutorPluginInformation, ITestExecutor, ITestExecutorCapabilities, TestExecutorMetadata>( TestPlatformConstants.TestAdapterEndsWithPattern, out unfilteredTestExtensions1, out testExtensions1); // Get all extensions for ITestExecutor2. TestPluginManager.Instance .GetSpecificTestExtensions <TestExecutorPluginInformation2, ITestExecutor2, ITestExecutorCapabilities, TestExecutorMetadata>( TestPlatformConstants.TestAdapterEndsWithPattern, out unfilteredTestExtensions2, out testExtensions2); // Merge the extension lists. var mergedUnfilteredTestExtensions = TestExecutorExtensionManager.MergeTestExtensionLists( unfilteredTestExtensions1, unfilteredTestExtensions2); var mergedTestExtensions = TestExecutorExtensionManager.MergeTestExtensionLists( testExtensions1, testExtensions2); // Create the TestExecutorExtensionManager using the merged extension list. testExecutorExtensionManager = new TestExecutorExtensionManager( mergedUnfilteredTestExtensions, mergedTestExtensions, TestSessionMessageLogger.Instance); } } } return(testExecutorExtensionManager); }