Skip to content

Commit

Permalink
fix test execution with NCrunch
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparnagy committed Nov 7, 2024
1 parent 1b8c323 commit ccf428b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Tests/Reqnroll.PluginTests/RuntimePluginLocatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private List<string> GetProjectReferencesDlls()
foreach (string projectReference in projectReferences)
{
//real ref, not test dependent
if (projectReference.Contains("Reqnroll.Generator.csproj"))
if (!projectReference.Contains("ReqnrollPlugin"))
continue;

var index = projectReference.LastIndexOf("\\", StringComparison.InvariantCulture);
Expand All @@ -96,10 +96,17 @@ private List<string> GetProjectReferences()
.Elements("ItemGroup")
.Elements("ProjectReference")
.Attributes("Include")
.Select(i => i.Value)
.ToList();
.Select(i => i.Value);

return projectReferences;
// For running this test with NCrunch we need to load the assembly references as well
// because NCrunch replaces project references with assembly references in the project file.
var assemblyReferences = project.Element("Project")
.Elements("ItemGroup")
.Elements("Reference")
.Attributes("Include")
.Select(i => Path.GetFileNameWithoutExtension(i.Value) + ".csproj");

return projectReferences.Concat(assemblyReferences).ToList();
}

}
Expand Down

0 comments on commit ccf428b

Please sign in to comment.