Skip to content

Commit

Permalink
fix(BaseAssertionAnalyzer): Don't fail if there are multiple referenc…
Browse files Browse the repository at this point in the history
…es to nunit
  • Loading branch information
Mikkel Bundgaard authored and Mikkel Bundgaard committed Dec 7, 2024
1 parent 260d60d commit ec10381
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nunit.analyzers/BaseAssertionAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Operations;
using NUnit.Analyzers.Constants;
using NUnit.Analyzers.Extensions;

namespace NUnit.Analyzers
Expand Down Expand Up @@ -50,7 +51,8 @@ private void AnalyzeCompilationStart(CompilationStartAnalysisContext context)
{
IEnumerable<AssemblyIdentity> referencedAssemblies = context.Compilation.ReferencedAssemblyNames;

AssemblyIdentity? nunit = referencedAssemblies.SingleOrDefault(a => a.Name.Equals("nunit.framework", StringComparison.OrdinalIgnoreCase));
AssemblyIdentity? nunit = referencedAssemblies.FirstOrDefault(a =>
a.Name.Equals(NUnitFrameworkConstants.NUnitFrameworkAssemblyName, StringComparison.OrdinalIgnoreCase));

if (nunit is null)
{
Expand Down

0 comments on commit ec10381

Please sign in to comment.