Skip to content

Commit e3e7323

Browse files
committed
update test expectations because hostfxr has different names on different platforms
1 parent cfd1308 commit e3e7323

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ public void PublishingRegistersWrittenFilesForProperCleanup()
541541
UseArtifactsOutput = true,
542542
};
543543

544+
var hostfxrName =
545+
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "hostfxr.dll" :
546+
RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "libhostfxr.so" :
547+
"libhostfxr.dylib";
548+
544549
var testAsset = _testAssetsManager.CreateTestProject(testProject);
545550

546551
// Now add a Directory.Build.props file setting UseArtifactsOutput to true
@@ -567,11 +572,11 @@ public void PublishingRegistersWrittenFilesForProperCleanup()
567572
.Pass();
568573

569574
var outputDir = new DirectoryInfo(OutputPathCalculator.FromProject(testAsset.Path, testProject).GetOutputDirectory(configuration: "release"));
570-
outputDir.Should().Exist().And.HaveFile("hostfxr.dll");
575+
outputDir.Should().Exist().And.HaveFile(hostfxrName);
571576
LocateAndRunApp(outputDir);
572577

573578
var publishDir = new DirectoryInfo(OutputPathCalculator.FromProject(testAsset.Path, testProject).GetPublishDirectory(configuration: "release"));
574-
publishDir.Should().Exist().And.HaveFile("hostfxr.dll");
579+
publishDir.Should().Exist().And.HaveFile(hostfxrName);
575580
LocateAndRunApp(publishDir);
576581

577582
// now build the app in Release configuration.
@@ -583,7 +588,7 @@ public void PublishingRegistersWrittenFilesForProperCleanup()
583588
.Should()
584589
.Pass();
585590
outputDir.Should().Exist();
586-
outputDir.Should().NotHaveFiles(["hostfxr.dll"]);
591+
outputDir.Should().NotHaveFiles([hostfxrName]);
587592
LocateAndRunApp(outputDir);
588593

589594
void LocateAndRunApp(DirectoryInfo root)

0 commit comments

Comments
 (0)