Rename project and namespaces
This commit is contained in:
parent
e7fa6194f6
commit
c9ed453745
1 changed files with 426 additions and 918 deletions
|
|
@ -1,22 +0,0 @@
|
|||
namespace McpDotNet.Tests.Utils;
|
||||
|
||||
public class MockHttpHandler : HttpMessageHandler
|
||||
{
|
||||
public Func<HttpRequestMessage, Task<HttpResponseMessage>>? RequestHandler { get; set; }
|
||||
|
||||
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (RequestHandler == null)
|
||||
throw new InvalidOperationException($"No {nameof(RequestHandler)} was set! Please set handler first and make request afterwards.");
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
throw new OperationCanceledException(cancellationToken);
|
||||
|
||||
var result = await RequestHandler.Invoke(request);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
throw new OperationCanceledException(cancellationToken);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue