diff --git a/src/NUnitConsole/nunit3-console/ConsoleOptions.cs b/src/NUnitConsole/nunit3-console/ConsoleOptions.cs index 23b9922b8..2939dc804 100644 --- a/src/NUnitConsole/nunit3-console/ConsoleOptions.cs +++ b/src/NUnitConsole/nunit3-console/ConsoleOptions.cs @@ -110,9 +110,6 @@ public List ResultOutputSpecifications { get { - //if (noresult) - // return new List(); - if (resultOutputSpecifications.Count == 0) resultOutputSpecifications.Add( new OutputSpecification("TestResult.xml", CURRENT_DIRECTORY_ON_ENTRY)); diff --git a/src/NUnitConsole/nunit3-console/ConsoleRunner.cs b/src/NUnitConsole/nunit3-console/ConsoleRunner.cs index 2f6ffaede..606fec6d0 100644 --- a/src/NUnitConsole/nunit3-console/ConsoleRunner.cs +++ b/src/NUnitConsole/nunit3-console/ConsoleRunner.cs @@ -56,7 +56,7 @@ public ConsoleRunner(ITestEngine engine, ConsoleOptions options, ExtendedTextWri Guard.ArgumentNotNull(_options = options, nameof(options)); Guard.ArgumentNotNull(_outWriter = writer, nameof(writer)); - // NOTE: Accessing Services triggerss the engine to initialize all services + // NOTE: Accessing Services triggers the engine to initialize all services _resultService = _engine.Services.GetService(); Guard.OperationValid(_resultService != null, "Internal Error: ResultService was not found"); @@ -74,10 +74,6 @@ public ConsoleRunner(ITestEngine engine, ConsoleOptions options, ExtendedTextWri foreach (string extensionDirectory in _options.ExtensionDirectories) _extensionService.FindExtensionAssemblies(extensionDirectory); - // Trigger lazy loading of extensions - var dummy = _extensionService.Extensions; - - _workDirectory = options.WorkDirectory; if (_workDirectory != null) Directory.CreateDirectory(_workDirectory); @@ -90,7 +86,6 @@ public ConsoleRunner(ITestEngine engine, ConsoleOptions options, ExtendedTextWri foreach (var node in _extensionService.GetExtensionNodes(EVENT_LISTENER_EXTENSION_PATH)) if (teamcityInstalled = node.TypeName == TEAMCITY_EVENT_LISTENER_FULLNAME) break; - //Guard.ArgumentValid(teamcityInstalled, "Option --teamcity specified but the extension is not installed.", "--teamCity"); if (!teamcityInstalled) throw new RequiredExtensionException(TEAMCITY_EVENT_LISTENER_NAME, "--teamcity"); } diff --git a/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs b/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs index f8c1d8784..a02d1b410 100644 --- a/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs +++ b/src/NUnitEngine/nunit.engine.core/Services/ExtensionManager.cs @@ -193,7 +193,7 @@ public void FindExtensionAssemblies(Assembly hostAssembly) /// public IExtensionPoint GetExtensionPoint(string path) { - return _extensionPointIndex.ContainsKey(path) ? _extensionPointIndex[path] : null; + return _extensionPointIndex.TryGetValue(path, out ExtensionPoint ep) ? ep : null; } /// @@ -425,10 +425,11 @@ private void ProcessCandidateAssembly(string filePath, bool fromWildCard) if (!CanLoadTargetFramework(Assembly.GetEntryAssembly(), candidateAssembly)) return; - // Do we already have a copy of the same assembly at a diffrent path? - if (_assemblies.ByName.ContainsKey(assemblyName)) + // Do we already have a copy of the same assembly at a different path? + //if (_assemblies.ByName.ContainsKey(assemblyName)) + if (_assemblies.ByName.TryGetValue(assemblyName, out ExtensionAssembly existing)) { - if (candidateAssembly.IsBetterVersionOf(_assemblies.ByName[assemblyName])) + if (candidateAssembly.IsBetterVersionOf(existing)) _assemblies.ByName[assemblyName] = candidateAssembly; return;