Skip to content

Commit

Permalink
Changes from second review
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Dec 13, 2024
1 parent f88cf00 commit 074d5f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/NUnitConsole/nunit3-console/ConsoleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ public List<OutputSpecification> ResultOutputSpecifications
{
get
{
//if (noresult)
// return new List<OutputSpecification>();

if (resultOutputSpecifications.Count == 0)
resultOutputSpecifications.Add(
new OutputSpecification("TestResult.xml", CURRENT_DIRECTORY_ON_ENTRY));
Expand Down
7 changes: 1 addition & 6 deletions src/NUnitConsole/nunit3-console/ConsoleRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IResultService>();
Guard.OperationValid(_resultService != null, "Internal Error: ResultService was not found");

Expand All @@ -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);
Expand All @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void FindExtensionAssemblies(Assembly hostAssembly)
/// </summary>
public IExtensionPoint GetExtensionPoint(string path)
{
return _extensionPointIndex.ContainsKey(path) ? _extensionPointIndex[path] : null;
return _extensionPointIndex.TryGetValue(path, out ExtensionPoint ep) ? ep : null;
}

/// <summary>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 074d5f4

Please sign in to comment.