From dc1c0442c755a6d9e6be09af6f9a170e001c4b09 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 19 Jun 2026 10:51:34 +0200 Subject: [PATCH] run tests on macos --- src/Tests/Tests.cs | 13 ++++++++++--- src/Tests/Tests.csproj | 4 ---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Tests/Tests.cs b/src/Tests/Tests.cs index 60edf70..9f01848 100644 --- a/src/Tests/Tests.cs +++ b/src/Tests/Tests.cs @@ -19,6 +19,12 @@ public class Tests "Newtonsoft.Json" }; + // Verify stores SolutionDirectory as a relative path ("../"), which AttributeReader returns + // verbatim; resolving it against the absolute project directory keeps paths correct regardless + // of the test runner's working directory. + static string SolutionDirectory => Path.GetFullPath( + Path.Combine(AttributeReader.GetProjectDirectory(), AttributeReader.GetSolutionDirectory())); + static Tests() { tempPath = Path.Combine(binDirectory, "Temp"); @@ -106,7 +112,7 @@ public Task Combo(bool copyPdbs, bool sign, bool internalize) [Fact] public async Task RunTask() { - var solutionDir = AttributeReader.GetSolutionDirectory(); + var solutionDir = SolutionDirectory; var buildResult = await Cli.Wrap("dotnet") .WithArguments("build --configuration IncludeAliasTask --no-restore") @@ -170,7 +176,7 @@ await Verify( [Fact] public async Task RunSample() { - var solutionDirectory = AttributeReader.GetSolutionDirectory(); + var solutionDirectory = SolutionDirectory; var targetPath = Path.Combine(solutionDirectory, "SampleApp/bin/Debug/net10.0"); @@ -202,7 +208,8 @@ public async Task RunSample() PatchDependencies(tempPath); - var exePath = Path.Combine(tempPath, "SampleApp.exe"); + var exeName = OperatingSystem.IsWindows() ? "SampleApp.exe" : "SampleApp"; + var exePath = Path.Combine(tempPath, exeName); var result = await Cli.Wrap(exePath).ExecuteBufferedAsync(); diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index ceb573b..3386f01 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -21,10 +21,6 @@ -