/// <summary>
        /// Provides a test discoverer based on the extension type of the identifier.
        /// </summary>
        /// <param name="identifier">The output path and name of the target name along with its extension</param>
        /// <param name="options">A structure which states particular features of interest in the manufactured product.</param>
        /// <returns>An IBoostTestDiscoverer instance or null if one cannot be provided.</returns>
        public IBoostTestDiscoverer GetTestDiscoverer(string identifier, BoostTestDiscovererFactoryOptions options)
        {
            IBoostTestDiscoverer discoverer = null;

            // Prefer external test discoverers over internal ones
            if ((options != null) && (options.ExternalTestRunnerSettings != null))
            {
                discoverer = GetExternalTestDiscoverer(identifier, options.ExternalTestRunnerSettings);
            }

            if (discoverer == null)
            {
                discoverer = GetInternalTestDiscoverer(identifier);
            }

            return discoverer;
        }
        public Type TestDiscovererProvisioning(string source, string externalExtension)
        {
            ExternalBoostTestRunnerSettings settings = null;

            if (!string.IsNullOrEmpty(externalExtension))
            {
                settings = new ExternalBoostTestRunnerSettings { ExtensionType = externalExtension };
            }

            BoostTestDiscovererFactoryOptions options = new BoostTestDiscovererFactoryOptions
            {
                ExternalTestRunnerSettings = settings
            };

            IBoostTestDiscoverer discoverer = this.Factory.GetTestDiscoverer(source, options);

            return (discoverer == null) ? null : discoverer.GetType();
        }
        /// <summary>
        /// Method call by Visual studio ("discovered via reflection") for test enumeration
        /// </summary>
        /// <param name="sources">path, target name and target extensions to discover</param>
        /// <param name="discoveryContext">discovery context settings</param>
        /// <param name="logger"></param>
        /// <param name="discoverySink">Unit test framework Sink</param>
        /// <remarks>Entry point of the discovery procedure</remarks>
        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger,
            ITestCaseDiscoverySink discoverySink)
        {
            #if DEBUG && LAUNCH_DEBUGGER
            System.Diagnostics.Debugger.Launch();
            #endif

            BoostTestAdapterSettings settings = BoostTestAdapterSettingsProvider.GetSettings(discoveryContext);

            BoostTestDiscovererFactoryOptions options = new BoostTestDiscovererFactoryOptions();
            options.ExternalTestRunnerSettings = settings.ExternalTestRunner;

            try
            {
                Logger.Initialize(logger);

                var sourceGroups = sources.GroupBy(Path.GetExtension);

                foreach (IGrouping<string, string> sourceGroup in sourceGroups)
                {
                    IBoostTestDiscoverer discoverer = TestDiscovererFactory.GetTestDiscoverer(sourceGroup.Key, options);

                    if (discoverer != null)
                    {
                        discoverer.DiscoverTests(sourceGroup, discoveryContext, logger, discoverySink);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Exception caught while discovering tests: {0} ({1})", ex.Message, ex.HResult);
                Logger.Error(ex.StackTrace);
            }
            finally
            {
                Logger.Shutdown();
            }
        }