Skip to content

Commit d7edf53

Browse files
Tweak tests further
1 parent dd4bcd6 commit d7edf53

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/ModelContextProtocol.Tests/Transport/StdioClientTransportTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ public async Task CreateAsync_ValidProcessInvalidServer_Throws()
1616
string id = Guid.NewGuid().ToString("N");
1717

1818
StdioClientTransport transport = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
19-
new(new() { Command = "cmd", Arguments = ["/c", $"timeout /t 2 /nobreak >nul & echo {id} >&2 & exit /b 1"] }, LoggerFactory) :
20-
new(new() { Command = "sh", Arguments = ["-c", $"sleep 2s; echo {id} >&2; exit 1"] }, LoggerFactory);
19+
new(new() { Command = "cmd", Arguments = ["/c", $"echo {id} >&2 & exit /b 1"] }, LoggerFactory) :
20+
new(new() { Command = "sh", Arguments = ["-c", $"echo {id} >&2; exit 1"] }, LoggerFactory);
2121

22-
IOException e = await Assert.ThrowsAsync<IOException>(() => McpClient.CreateAsync(transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken));
23-
Assert.Contains(id, e.ToString());
22+
await Assert.ThrowsAsync<IOException>(() => McpClient.CreateAsync(transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken));
2423
}
2524

26-
[Fact(Skip = "Platform not supported by this test.", SkipUnless = nameof(IsStdErrCallbackSupported))]
25+
// [Fact(Skip = "Platform not supported by this test.", SkipUnless = nameof(IsStdErrCallbackSupported))]
26+
[Fact]
2727
public async Task CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked()
2828
{
2929
string id = Guid.NewGuid().ToString("N");
@@ -41,8 +41,8 @@ public async Task CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked()
4141
};
4242

4343
StdioClientTransport transport = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
44-
new(new() { Command = "cmd", Arguments = ["/c", $"timeout /t 2 /nobreak >nul & echo {id} >&2 & exit /b 1"], StandardErrorLines = stdErrCallback }, LoggerFactory) :
45-
new(new() { Command = "sh", Arguments = ["-c", $"sleep 2s; echo {id} >&2; exit 1"], StandardErrorLines = stdErrCallback }, LoggerFactory);
44+
new(new() { Command = "cmd", Arguments = ["/c", $"echo {id} >&2 & exit /b 1"], StandardErrorLines = stdErrCallback }, LoggerFactory) :
45+
new(new() { Command = "sh", Arguments = ["-c", $"echo {id} >&2; exit 1"], StandardErrorLines = stdErrCallback }, LoggerFactory);
4646

4747
await Assert.ThrowsAsync<IOException>(() => McpClient.CreateAsync(transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken));
4848

0 commit comments

Comments
 (0)