Enable netfx testing. (#588)

* Enable netfx testing.

* Skip impacted tests and re-enable netfx testing.

* Remove redundant comment.

* Remove unnecessary project configuration.

* Simplify test server copying.
This commit is contained in:
Eirik Tsarpalis 2025-07-08 18:50:37 +03:00 • committed by GitHub
commit aa75f6f37e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1940 additions and 53 deletions

View file

@ -15,10 +15,18 @@ public class SseResponseStreamTransportTests(ITestOutputHelper testOutputHelper)
var transportRunTask = transport.RunAsync(TestContext.Current.CancellationToken);
using var responseStreamReader = new StreamReader(responsePipe.Reader.AsStream());
var firstLine = await responseStreamReader.ReadLineAsync(TestContext.Current.CancellationToken);
var firstLine = await responseStreamReader.ReadLineAsync(
#if NET
TestContext.Current.CancellationToken
#endif
);
Assert.Equal("event: endpoint", firstLine);
var secondLine = await responseStreamReader.ReadLineAsync(TestContext.Current.CancellationToken);
var secondLine = await responseStreamReader.ReadLineAsync(
#if NET
TestContext.Current.CancellationToken
#endif
);
Assert.Equal("data: /my-message-endpoint", secondLine);
responsePipe.Reader.Complete();

View file

@ -7,6 +7,8 @@ namespace ModelContextProtocol.Tests.Transport;
public class StdioClientTransportTests(ITestOutputHelper testOutputHelper) : LoggedTest(testOutputHelper)
{
public static bool IsStdErrCallbackSupported => !PlatformDetection.IsMonoRuntime;
[Fact]
public async Task CreateAsync_ValidProcessInvalidServer_Throws()
{
@ -19,8 +21,8 @@ public class StdioClientTransportTests(ITestOutputHelper testOutputHelper) : Log
IOException e = await Assert.ThrowsAsync<IOException>(() => McpClientFactory.CreateAsync(transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken));
Assert.Contains(id, e.ToString());
}
[Fact]
[Fact(Skip = "Platform not supported by this test.", SkipUnless = nameof(IsStdErrCallbackSupported))]
public async Task CreateAsync_ValidProcessInvalidServer_StdErrCallbackInvoked()
{
string id = Guid.NewGuid().ToString("N");