Improve testing for StreamableHttpHandler and IdleTrackingBackgroundService (#345)
* Add idle session pruning tests
* Remove redundant CTS from StreamableHttpHandler
* StreamableHttpServerTransport.HandlePostRequest already creates the equivelant CTS
which DeleteRequest_CompletesSession_WhichCancelsLongRunningToolCalls verifies
* Fix accept header validation for GET
* Use InvalidOperationException for transport-not-connected errors in doc comments
* Fix flaky Cancellation_ThrowsCancellationException test
This commit is contained in:
parent
4fd3ebf3fe
commit
e3ff552824
1 changed files with 315 additions and 291 deletions
|
|
@ -1,30 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ModelContextProtocol.Tests.Utils;
|
||||
|
||||
public class LoggedTest : IDisposable
|
||||
{
|
||||
private readonly DelegatingTestOutputHelper _delegatingTestOutputHelper;
|
||||
|
||||
public LoggedTest(ITestOutputHelper testOutputHelper)
|
||||
{
|
||||
_delegatingTestOutputHelper = new()
|
||||
{
|
||||
CurrentTestOutputHelper = testOutputHelper,
|
||||
};
|
||||
LoggerProvider = new XunitLoggerProvider(_delegatingTestOutputHelper);
|
||||
LoggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
|
||||
{
|
||||
builder.AddProvider(LoggerProvider);
|
||||
});
|
||||
}
|
||||
|
||||
public ITestOutputHelper TestOutputHelper => _delegatingTestOutputHelper;
|
||||
public ILoggerFactory LoggerFactory { get; }
|
||||
public ILoggerProvider LoggerProvider { get; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
_delegatingTestOutputHelper.CurrentTestOutputHelper = null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue