From ec10381f2646f5b3954add9d147ad6a2e99bef9a Mon Sep 17 00:00:00 2001 From: Mikkel Bundgaard Date: Sat, 7 Dec 2024 21:37:10 +0000 Subject: [PATCH] fix(BaseAssertionAnalyzer): Don't fail if there are multiple references to nunit --- src/nunit.analyzers/BaseAssertionAnalyzer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nunit.analyzers/BaseAssertionAnalyzer.cs b/src/nunit.analyzers/BaseAssertionAnalyzer.cs index 82f0e5b6..503caf87 100644 --- a/src/nunit.analyzers/BaseAssertionAnalyzer.cs +++ b/src/nunit.analyzers/BaseAssertionAnalyzer.cs @@ -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 @@ -50,7 +51,8 @@ private void AnalyzeCompilationStart(CompilationStartAnalysisContext context) { IEnumerable 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) {