Skip to content

Commit f675320

Browse files
committed
Use LoggedTest
1 parent 98b3879 commit f675320

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/ModelContextProtocol.Tests/StdioServerIntegrationTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using ModelContextProtocol.Client;
22
using ModelContextProtocol.Protocol.Transport;
3+
using ModelContextProtocol.Tests.Utils;
34
using System.Diagnostics;
45
using System.Runtime.InteropServices;
56

67
namespace ModelContextProtocol.Tests;
78

8-
public class StdioServerIntegrationTests
9+
public class StdioServerIntegrationTests(ITestOutputHelper testOutputHelper) : LoggedTest(testOutputHelper)
910
{
1011
public static bool CanSendSigInt { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
11-
internal const int SIGINT = 2;
12+
private const int SIGINT = 2;
1213

1314
[Fact(Skip = "Platform not supported by this test.", SkipUnless = nameof(CanSendSigInt))]
1415
public async Task SigInt_DisposesTestServerWithHosting_Gracefully()
@@ -42,10 +43,11 @@ public async Task SigInt_DisposesTestServerWithHosting_Gracefully()
4243

4344
await using var client = await McpClientFactory.CreateAsync(serverConfig,
4445
createTransportFunc: (_, _) => new TestClientTransport(streamServerTransport),
46+
loggerFactory: LoggerFactory,
4547
cancellationToken: TestContext.Current.CancellationToken);
4648

47-
// I considered writing a similar test for windows using Ctrl-C, then saw that dotnet watch doesn't even send a Ctrl-C
48-
// signal because it's such a pain without support CREATE_NEW_PROCESS_GROUP in System.Diagnostics.Process.
49+
// I considered writing a similar test for Windows using Ctrl-C, then saw that dotnet watch doesn't even send a Ctrl-C
50+
// signal because it's such a pain without support for CREATE_NEW_PROCESS_GROUP in System.Diagnostics.Process.
4951
// https://github.com/dotnet/sdk/blob/43b1c12e3362098a23ca1018503eb56516840b6a/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs#L277-L303
5052
// https://github.com/dotnet/runtime/issues/109432, https://github.com/dotnet/runtime/issues/44944
5153
Assert.Equal(0, kill(process.Id, SIGINT));
@@ -59,13 +61,11 @@ public async Task SigInt_DisposesTestServerWithHosting_Gracefully()
5961
}
6062

6163
[DllImport("libc", SetLastError = true)]
62-
internal static extern int kill(int pid, int sig);
64+
private static extern int kill(int pid, int sig);
6365

6466
private sealed class TestClientTransport(ITransport sessionTransport) : IClientTransport
6567
{
6668
public Task<ITransport> ConnectAsync(CancellationToken cancellationToken = default)
67-
{
68-
return Task.FromResult(sessionTransport);
69-
}
69+
=> Task.FromResult(sessionTransport);
7070
}
7171
}

0 commit comments

Comments
 (0)