public string Process() { var loadContext = LoadContextHelper.CreateLoadContext(_options.AssemblyFilePath); var targetFolder = Path.GetDirectoryName(_options.AssemblyFilePath); if (targetFolder == null) { return(null); } var connectorFolder = Path.GetDirectoryName(typeof(ConsoleRunner).Assembly.GetLocalCodeBase()); Debug.Assert(connectorFolder != null); var specFlowVersion = GetSpecFlowVersion(); var discovererType = typeof(SpecFlowV3000Discoverer); if (specFlowVersion != null) { switch (specFlowVersion.FileMajorPart * 1000 + specFlowVersion.FileMinorPart * 10) { case 3000: discovererType = typeof(SpecFlowV3000Discoverer); break; } } using (var discoverer = new ReflectionSpecFlowDiscoverer(loadContext, discovererType)) { var testAssembly = loadContext.LoadFromAssemblyPath(_options.AssemblyFilePath); return(discoverer.Discover(testAssembly, _options.AssemblyFilePath, _options.ConfigFilePath)); } }
public string Process() { var pluginLoader = PluginLoader.CreateFromAssemblyFile(_options.AssemblyFilePath, PluginLoaderOptions.IncludeCompileLibraries); var targetFolder = Path.GetDirectoryName(_options.AssemblyFilePath); if (targetFolder == null) { return(null); } var connectorFolder = Path.GetDirectoryName(typeof(ConsoleRunner).Assembly.GetLocalCodeBase()); Debug.Assert(connectorFolder != null); using (var discoverer = new ReflectionSpecFlowDiscoverer(GetLoadContext(pluginLoader), typeof(VersionSelectorDiscoverer))) { var testAssembly = pluginLoader.LoadDefaultAssembly(); return(discoverer.Discover(testAssembly, _options.AssemblyFilePath, _options.ConfigFilePath)); } }