Add XunitLoggerProvider (#81)

* Add XunitLoggerProvider

* Avoid logging to stale ITestOutputHelper in fixture disposal

* Use LoggedTest base class everywhere an ILoggerFactory is used
This commit is contained in:
Stephen Halter 2025-03-25 05:53:55 -07:00 • committed by GitHub
commit 60ea96a97c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,18 @@
using ModelContextProtocol.Client;
using ModelContextProtocol.Protocol.Types;
using ModelContextProtocol.Tests.Utils;
namespace ModelContextProtocol.Tests;
public class SseServerIntegrationTests : IClassFixture<SseServerIntegrationTestFixture>
public class SseServerIntegrationTests : LoggedTest, IClassFixture<SseServerIntegrationTestFixture>
{
private readonly SseServerIntegrationTestFixture _fixture;
public SseServerIntegrationTests(SseServerIntegrationTestFixture fixture)
public SseServerIntegrationTests(SseServerIntegrationTestFixture fixture, ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
_fixture = fixture;
_fixture.Initialize(testOutputHelper);
}
private Task<IMcpClient> GetClientAsync(McpClientOptions? options = null)
@ -17,7 +20,7 @@ public class SseServerIntegrationTests : IClassFixture<SseServerIntegrationTestF
return McpClientFactory.CreateAsync(
_fixture.DefaultConfig,
options ?? _fixture.DefaultOptions,
loggerFactory: _fixture.LoggerFactory);
loggerFactory: LoggerFactory);
}
[Fact]