diff --git a/tests/ModelContextProtocol.Tests/ClientIntegrationTestFixture.cs b/tests/ModelContextProtocol.Tests/ClientIntegrationTestFixture.cs index 6f0e8e44a..726a3fb1a 100644 --- a/tests/ModelContextProtocol.Tests/ClientIntegrationTestFixture.cs +++ b/tests/ModelContextProtocol.Tests/ClientIntegrationTestFixture.cs @@ -16,6 +16,8 @@ public class ClientIntegrationTestFixture public ClientIntegrationTestFixture() { const string ServerEverythingVersion = "2026.1.26"; + string testServerExecutable = Path.Combine(AppContext.BaseDirectory, "TestServer.exe"); + string testServerDll = Path.Combine(AppContext.BaseDirectory, "TestServer.dll"); EverythingServerTransportOptions = new() { @@ -27,14 +29,14 @@ public ClientIntegrationTestFixture() TestServerTransportOptions = new() { - Command = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "TestServer.exe" : PlatformDetection.IsMonoRuntime ? "mono" : "dotnet", + Command = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? testServerExecutable : PlatformDetection.IsMonoRuntime ? "mono" : "dotnet", Name = "TestServer", }; if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // Change to Arguments to "mcp-server-everything" if you want to run the server locally after creating a symlink - TestServerTransportOptions.Arguments = [PlatformDetection.IsMonoRuntime ? "TestServer.exe" : "TestServer.dll"]; + TestServerTransportOptions.Arguments = [PlatformDetection.IsMonoRuntime ? testServerExecutable : testServerDll]; } } diff --git a/tests/ModelContextProtocol.Tests/Transport/StdioClientTransportTests.cs b/tests/ModelContextProtocol.Tests/Transport/StdioClientTransportTests.cs index 8b7876271..a709688b4 100644 --- a/tests/ModelContextProtocol.Tests/Transport/StdioClientTransportTests.cs +++ b/tests/ModelContextProtocol.Tests/Transport/StdioClientTransportTests.cs @@ -154,6 +154,8 @@ public async Task EscapesCliArgumentsCorrectly(string? cliArgumentValue) } string cliArgument = $"--cli-arg={cliArgumentValue}"; + string testServerExecutable = Path.Combine(AppContext.BaseDirectory, "TestServer.exe"); + string testServerDll = Path.Combine(AppContext.BaseDirectory, "TestServer.dll"); StdioClientTransportOptions options = new() { @@ -161,14 +163,14 @@ public async Task EscapesCliArgumentsCorrectly(string? cliArgumentValue) Command = (PlatformDetection.IsMonoRuntime, PlatformDetection.IsWindows) switch { (true, _) => "mono", - (_, true) => "TestServer.exe", + (_, true) => testServerExecutable, _ => "dotnet", }, Arguments = (PlatformDetection.IsMonoRuntime, PlatformDetection.IsWindows) switch { - (true, _) => ["TestServer.exe", cliArgument], + (true, _) => [testServerExecutable, cliArgument], (_, true) => [cliArgument], - _ => ["TestServer.dll", cliArgument], + _ => [testServerDll, cliArgument], }, };